随笔分类 -  LeetCode

上一页 1 ··· 18 19 20 21 22 23 24 25 26 ··· 61 下一页
摘要:We have a list of bus routes. Each routes[i] is a bus route that the i-th bus repeats forever. For example if routes[0] = [1, 5, 7], this means that t 阅读全文
posted @ 2019-01-20 05:58 Grandyang 阅读(4789) 评论(3) 推荐(0)
摘要:In a given integer array A, we must move every element of A to either list B or list C. (B and C initially start empty.) Return true if and only if af 阅读全文
posted @ 2019-01-17 23:56 Grandyang 阅读(4564) 评论(2) 推荐(0)
摘要:We have jobs: difficulty[i] is the difficulty of the ith job, and profit[i] is the profit of the ith job. Now we have some workers. worker[i] is the a 阅读全文
posted @ 2019-01-14 00:00 Grandyang 阅读(2453) 评论(0) 推荐(0)
摘要:Some people will make friend requests. The list of their ages is given and ages[i] is the age of the ith person. Person A will NOT friend request pers 阅读全文
posted @ 2019-01-10 23:12 Grandyang 阅读(3280) 评论(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 @ 2019-01-08 01:36 Grandyang 阅读(2434) 评论(0) 推荐(0)
摘要:Given an array of unique integers, each integer is strictly greater than 1. We make a binary tree using these integers and each number may be used for 阅读全文
posted @ 2019-01-05 00:00 Grandyang 阅读(2153) 评论(0) 推荐(0)
摘要:On a table are N cards, with a positive integer printed on the front and back of each card (possibly different). We flip any number of cards, and afte 阅读全文
posted @ 2018-12-23 07:49 Grandyang 阅读(2330) 评论(0) 推荐(0)
摘要:Given a string S and a character C, return an array of integers representing the shortest distance from the character C in the string. Example 1: Inpu 阅读全文
posted @ 2018-12-13 11:59 Grandyang 阅读(2589) 评论(0) 推荐(0)
摘要:Given a list of words, we may encode it by writing a reference string S and a list of indexes A. For example, if the list of words is ["time", "me", " 阅读全文
posted @ 2018-12-08 23:48 Grandyang 阅读(3118) 评论(1) 推荐(0)
摘要:Given a paragraph and a list of banned words, return the most frequent word that is not in the list of banned words. It is guaranteed there is at leas 阅读全文
posted @ 2018-12-04 00:57 Grandyang 阅读(3606) 评论(1) 推荐(0)
摘要:Given a blacklist B containing unique integers from [0, N), write a function to return a uniform random integer from [0, N) which is NOT in B. Optimiz 阅读全文
posted @ 2018-11-27 23:23 Grandyang 阅读(3385) 评论(0) 推荐(1)
摘要:Implement function ToLowerCase() that has a string parameter str, and returns the same string in lowercase. Example 1: Input: "Hello" Output: "hello" 阅读全文
posted @ 2018-11-25 23:09 Grandyang 阅读(1673) 评论(0) 推荐(0)
摘要:Design your implementation of the linked list. You can choose to use the singly linked list or the doubly linked list. A node in a singly linked list 阅读全文
posted @ 2018-11-23 09:03 Grandyang 阅读(5842) 评论(3) 推荐(0)
摘要:Given a robot cleaner in a room modeled as a grid. Each cell in the grid can be empty or blocked. The robot cleaner with 4 given APIs can move forward 阅读全文
posted @ 2018-11-20 12:39 Grandyang 阅读(15069) 评论(8) 推荐(2)
摘要:Given a node from a Circular Linked List which is sorted in ascending order, write a function to insert a value insertVal into the list such that it r 阅读全文
posted @ 2018-11-19 01:15 Grandyang 阅读(6428) 评论(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 @ 2018-11-17 05:43 Grandyang 阅读(7940) 评论(2) 推荐(0)
摘要:Design a HashSet without using any built-in hash table libraries. To be specific, your design should include these functions: add(value): Insert a val 阅读全文
posted @ 2018-11-15 23:19 Grandyang 阅读(5300) 评论(0) 推荐(0)
摘要:Serialization is the process of converting a data structure or object into a sequence of bits so that it can be stored in a file or memory buffer, or 阅读全文
posted @ 2018-11-12 11:21 Grandyang 阅读(6522) 评论(0) 推荐(0)
摘要:Design an algorithm to encode an N-ary tree into a binary tree and decode the binary tree to get the original N-ary tree. An N-ary tree is a rooted tr 阅读全文
posted @ 2018-11-12 11:08 Grandyang 阅读(3842) 评论(4) 推荐(0)
摘要:Design a class to find the kth largest element in a stream. Note that it is the kth largest element in the sorted order, not the kth distinct element. 阅读全文
posted @ 2018-11-11 09:19 Grandyang 阅读(6358) 评论(0) 推荐(0)

上一页 1 ··· 18 19 20 21 22 23 24 25 26 ··· 61 下一页
Fork me on GitHub