问题:找第 K 大的数在一个数组里在数据流中找最大的 K 个数在一个数组里在数据流中找出现频率最高的 K 个数在一个数组中在数据流中在文件中这种题适合各种follow up核实问题:是否需要精确的结果?数据是离线的(文件形式计算一次得到一个结果)还是在线的(数据流可无限次查询实时结果)?-问题1 - 找第 K 大的数:在一个...
Given a 2D board and a word, find if the word exists in the grid. The word can be constructed from letters of sequentially adjacent cell, where "adjacent" cells are those horizontally or vertically neighboring. The same >letter cell may not be used more than once. For example, Given board = {...
Given n nodes labeled from 0 to n - 1 and a list of directed edges (each edge is a pair of nodes), write a function to check whether the graph contains a cycle. if edges = [0, 1], [1, 2], [0, 2]], it means 0 -> 1, 1 ->2, 0 -> 2. edges[i is parent, edgesi is child. For example: Given n = ...
Given n nodes labeled from 0 to n - 1 and a list of undirected edges (each edge is a pair of nodes), write a function to check whether these edges make up a valid tree. For example: Given n = 5 and edges = [[0, 1], [0, 2], [0, 3], [1, 4]], return true. Given n = 5 and edges = [[0, 1], [1, 2], [2,...
Implement a basic calculator to evaluate a simple expression string. The expression string contains only non-negative integers, +, -, *, / operators and empty spaces . The integer division should truncate toward zero. You may assume that the given expression is always valid. Some examples: "3+2*2...