上一页 1 ··· 36 37 38 39 40 41 42 43 44 ··· 64 下一页
摘要: 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 阅读(195) 评论(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 阅读(236) 评论(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 阅读(211) 评论(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 阅读(242) 评论(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 阅读(607) 评论(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 阅读(256) 评论(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 阅读(241) 评论(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 阅读(233) 评论(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 阅读(938) 评论(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 阅读(599) 评论(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 阅读(473) 评论(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 阅读(128) 评论(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 阅读(217) 评论(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 阅读(289) 评论(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 阅读(318) 评论(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 阅读(199) 评论(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 阅读(249) 评论(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 阅读(147) 评论(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 阅读(366) 评论(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 阅读(425) 评论(0) 推荐(0)
上一页 1 ··· 36 37 38 39 40 41 42 43 44 ··· 64 下一页