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 阅读全文
posted @ 2020-08-31 14:44 CNoodle 阅读(264) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-08-28 06:48 CNoodle 阅读(265) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-08-28 01:25 CNoodle 阅读(218) 评论(0) 推荐(0)
摘要:Design a HashMap without using any built-in hash table libraries. Implement the MyHashMap class: MyHashMap() initializes the object with an empty map. 阅读全文
posted @ 2020-08-27 07:11 CNoodle 阅读(203) 评论(0) 推荐(0)
摘要:Design an iterator to flatten a 2D vector. It should support the next and hasNext operations. Implement the Vector2D class: Vector2D(int[][] vec) init 阅读全文
posted @ 2020-08-27 02:09 CNoodle 阅读(243) 评论(0) 推荐(0)
摘要:Given an Iterator class interface with methods: next() and hasNext(), design and implement a PeekingIterator that support the peek() operation -- it e 阅读全文
posted @ 2020-08-26 15:26 CNoodle 阅读(214) 评论(0) 推荐(0)
摘要:Given two vectors of integers v1 and v2, implement an iterator to return their elements alternately. Implement the ZigzagIterator class: ZigzagIterato 阅读全文
posted @ 2020-08-26 14:09 CNoodle 阅读(252) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-08-26 05:46 CNoodle 阅读(612) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-08-26 01:50 CNoodle 阅读(266) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-08-25 12:54 CNoodle 阅读(246) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-08-25 10:09 CNoodle 阅读(238) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-08-25 06:20 CNoodle 阅读(1002) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-08-25 03:07 CNoodle 阅读(607) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-08-24 06:25 CNoodle 阅读(476) 评论(0) 推荐(0)
摘要: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[ 阅读全文
posted @ 2020-08-22 05:47 CNoodle 阅读(138) 评论(0) 推荐(0)
摘要: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. 阅读全文
posted @ 2020-08-22 02:37 CNoodle 阅读(225) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-08-21 14:48 CNoodle 阅读(293) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-08-21 05:55 CNoodle 阅读(327) 评论(0) 推荐(0)
摘要:You have a data structure of employee information, including the employee's unique ID, importance value, and direct subordinates' IDs. You are given a 阅读全文
posted @ 2020-08-21 01:06 CNoodle 阅读(200) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-08-20 02:24 CNoodle 阅读(256) 评论(0) 推荐(0)
摘要: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  阅读全文
posted @ 2020-08-19 08:48 CNoodle 阅读(153) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-08-19 00:53 CNoodle 阅读(375) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-08-18 10:37 CNoodle 阅读(429) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-08-18 01:47 CNoodle 阅读(605) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-08-17 02:22 CNoodle 阅读(267) 评论(0) 推荐(0)
摘要: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 + 阅读全文
posted @ 2020-08-16 12:05 CNoodle 阅读(333) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-08-14 13:49 CNoodle 阅读(185) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-08-13 05:56 CNoodle 阅读(202) 评论(0) 推荐(0)
摘要:168. Excel Sheet Column Title Given an integer columnNumber, return its corresponding column title as it appears in an Excel sheet. For example: A -> 阅读全文
posted @ 2020-08-11 00:22 CNoodle 阅读(196) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-08-10 13:02 CNoodle 阅读(337) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-08-09 06:50 CNoodle 阅读(140) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-08-06 23:55 CNoodle 阅读(222) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-08-05 02:43 CNoodle 阅读(743) 评论(2) 推荐(0)
摘要: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 阅读全文
posted @ 2020-08-05 01:49 CNoodle 阅读(238) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-08-04 11:16 CNoodle 阅读(431) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-08-04 01:32 CNoodle 阅读(275) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-08-03 12:35 CNoodle 阅读(191) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-08-01 04:37 CNoodle 阅读(220) 评论(0) 推荐(0)
摘要: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[ 阅读全文
posted @ 2020-08-01 00:34 CNoodle 阅读(570) 评论(0) 推荐(0)