08 2020 档案
摘要:Alice has some number of cards and she wants to rearrange the cards into groups so that each group is of size groupSize, and consists of groupSize con
阅读全文
摘要:You are given an array of intervals, where intervals[i] = [starti, endi] and each starti is unique. The right interval for an interval i is an interva
阅读全文
摘要:There is a robot starting at position (0, 0), the origin, on a 2D plane. Given a sequence of its moves, judge if this robot ends up at (0, 0) after it
阅读全文
摘要:Design a HashMap without using any built-in hash table libraries. Implement the MyHashMap class: MyHashMap() initializes the object with an empty map.
阅读全文
摘要:Design an iterator to flatten a 2D vector. It should support the next and hasNext operations. Implement the Vector2D class: Vector2D(int[][] vec) init
阅读全文
摘要:Given an Iterator class interface with methods: next() and hasNext(), design and implement a PeekingIterator that support the peek() operation -- it e
阅读全文
摘要:Given two vectors of integers v1 and v2, implement an iterator to return their elements alternately. Implement the ZigzagIterator class: ZigzagIterato
阅读全文
摘要:You have n processes forming a rooted tree structure. You are given two integer arrays pid and ppid, where pid[i] is the ID of the ith process and ppi
阅读全文
摘要:Given two strings A and B, find the minimum number of times A has to be repeated such that B is a substring of it. If no such solution, return -1. For
阅读全文
摘要:You are given a nested list of integers nestedList. Each element is either an integer or a list whose elements may also be integers or other lists. Im
阅读全文
摘要:Find the sum of all left leaves in a given binary tree. Example: 3 / \ 9 20 / \ 15 7 There are two left leaves in the binary tree, with values 9 and 1
阅读全文
摘要:Given the root of a binary tree, collect a tree's nodes as if you were doing this: Collect all the leaf nodes. Remove all the leaf nodes. Repeat until
阅读全文
摘要:A binary tree is given such that each node contains an additional random pointer which could point to any node in the tree or null. Return a deep copy
阅读全文
摘要:Given a string s, check if it can be constructed by taking a substring of it and appending multiple copies of the substring together. Example 1: Input
阅读全文
摘要:A zero-indexed array A of length N contains all integers from 0 to N-1. Find and return the longest length of set S, where S[i] = {A[i], A[A[i]], A[A[
阅读全文
摘要:You have 4 cards each containing a number from 1 to 9. You need to judge whether they could operated through *, /, +, -, (, ) to get the value of 24.
阅读全文
摘要:You are given a nested list of integers nestedList. Each element is either an integer or a list whose elements may also be integers or other lists. Th
阅读全文
摘要:You are given a nested list of integers nestedList. Each element is either an integer or a list whose elements may also be integers or other lists. Th
阅读全文
摘要:You have a data structure of employee information, including the employee's unique ID, importance value, and direct subordinates' IDs. You are given a
阅读全文
摘要:A sentence S is given, composed of words separated by spaces. Each word consists of lowercase and uppercase letters only. We would like to convert the
阅读全文
摘要:Given a string s, return the number of palindromic substrings in it. A string is a palindrome when it reads the same backward as forward. A substring
阅读全文
摘要:Given an array with n integers, you need to find if there are triplets (i, j, k) which satisfies following conditions: 0 < i, i + 1 < j, j + 1 < k < n
阅读全文
摘要:You have an array arr of length n where arr[i] = (2 * i) + 1 for all valid values of i (i.e. 0 <= i < n). In one operation, you can select two indices
阅读全文
摘要:There are n oranges in the kitchen and you decided to eat some of these oranges every day as follows: Eat one orange. If the number of remaining orang
阅读全文
摘要:Given two strings s and t, return true if they are both one edit distance apart, otherwise return false. A string s is said to be one distance apart f
阅读全文
摘要:Given a 2D grid of size m x n and an integer k. You need to shift the grid k times. In one shift operation: Element at grid[i][j] moves to grid[i][j +
阅读全文
摘要:There is a brick wall in front of you. The wall is rectangular and has several rows of bricks. The bricks have the same height but different width. Yo
阅读全文
摘要:Given the root of an n-ary tree, return the postorder traversal of its nodes' values. Nary-Tree input serialization is represented in their level orde
阅读全文
摘要:168. Excel Sheet Column Title Given an integer columnNumber, return its corresponding column title as it appears in an Excel sheet. For example: A ->
阅读全文
摘要:Give a string s, count the number of non-empty (contiguous) substrings that have the same number of 0's and 1's, and all the 0's and all the 1's in th
阅读全文
摘要:Given the root of a tree, you are asked to find the most frequent subtree sum. The subtree sum of a node is defined as the sum of all the node values
阅读全文
摘要:You have a lock in front of you with 4 circular wheels. Each wheel has 10 slots: '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'. The wheels can rota
阅读全文
摘要:A set of real numbers can be represented as the union of several disjoint intervals, where each interval is in the form [a, b). A real number x is in
阅读全文
摘要:The thief has found himself a new place for his thievery again. There is only one entrance to this area, called root. Besides the root, each house has
阅读全文
摘要:There are n different online courses numbered from 1 to n. You are given an array courses where courses[i] = [durationi, lastDayi] indicate that the i
阅读全文
摘要:Given a stream of integers and a window size, calculate the moving average of all integers in the sliding window. Example: MovingAverage m = new Movin
阅读全文
摘要:Design your implementation of the circular queue. The circular queue is a linear data structure in which the operations are performed based on FIFO (F
阅读全文
摘要:You have k lists of sorted integers in ascending order. Find the smallest range that includes at least one number from each of the k lists. We define
阅读全文
摘要:Given an integer array nums and two integers k and t, return true if there are two distinct indices i and j in the array such that abs(nums[i] - nums[
阅读全文

浙公网安备 33010602011771号