随笔分类 -  LeetCode

上一页 1 2 3 4 5 6 7 ··· 12 下一页
摘要:Given a non-empty array of integers, return the k most frequent elements. Example 1: Example 2: Input: nums = [1], k = 1 Output: [1] Example 2: Note: 阅读全文
posted @ 2019-01-11 15:30 __Meng 阅读(155) 评论(0) 推荐(0)
摘要:Given a binary tree, return the inorder traversal of its nodes' values. Example: Follow up: Recursive solution is trivial, could you do it iteratively 阅读全文
posted @ 2019-01-11 11:22 __Meng 阅读(123) 评论(0) 推荐(0)
摘要:Given a string, your task is to count how many palindromic substrings in this string. The substrings with different start indexes or end indexes are c 阅读全文
posted @ 2019-01-11 10:52 __Meng 阅读(161) 评论(0) 推荐(0)
摘要:Suppose you have a random list of people standing in a queue. Each person is described by a pair of integers (h, k), where h is the height of the pers 阅读全文
posted @ 2019-01-11 10:26 __Meng 阅读(195) 评论(0) 推荐(0)
摘要:Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in their binary representation and r 阅读全文
posted @ 2019-01-11 09:45 __Meng 阅读(118) 评论(0) 推荐(0)
摘要:Given a set of distinct integers, nums, return all possible subsets (the power set). Note: The solution set must not contain duplicate subsets. Exampl 阅读全文
posted @ 2019-01-10 16:58 __Meng 阅读(137) 评论(0) 推荐(0)
摘要:Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and put. get(key) - Get the 阅读全文
posted @ 2018-10-25 16:45 __Meng 阅读(248) 评论(0) 推荐(0)
摘要:Write a bash script to calculate the frequency of each word in a text file words.txt. For simplicity sake, you may assume: words.txt contains only low 阅读全文
posted @ 2018-07-13 17:24 __Meng 阅读(186) 评论(0) 推荐(0)
摘要:Given a text file file.txt that contains list of phone numbers (one per line), write a one liner bash script to print all valid phone numbers. You may 阅读全文
posted @ 2018-07-13 16:30 __Meng 阅读(206) 评论(0) 推荐(0)
摘要:Given a text file file.txt, print just the 10th line of the file. Example: Assume that file.txt has the following content: Your script should output t 阅读全文
posted @ 2018-07-12 18:33 __Meng 阅读(125) 评论(0) 推荐(0)
摘要:Given an integer n, count the total number of digit 1 appearing in all non-negative integers less than or equal to n. For example:Given n = 13,Return 阅读全文
posted @ 2018-05-07 18:20 __Meng 阅读(165) 评论(0) 推荐(0)
摘要:You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping yo 阅读全文
posted @ 2018-03-21 17:03 __Meng 阅读(120) 评论(0) 推荐(0)
摘要:Reverse bits of a given 32 bits unsigned integer. For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), retur 阅读全文
posted @ 2018-03-21 16:21 __Meng 阅读(103) 评论(0) 推荐(0)
摘要:Implement int sqrt(int x). Compute and return the square root of x. x is guaranteed to be a non-negative integer. Example 1: Example 2: 阅读全文
posted @ 2018-03-21 16:04 __Meng 阅读(118) 评论(0) 推荐(0)
摘要:Given a positive integer, return its corresponding column title as appear in an Excel sheet. For example: 阅读全文
posted @ 2018-03-21 15:29 __Meng 阅读(122) 评论(0) 推荐(0)
摘要:Description: Count the number of prime numbers less than a non-negative number, n. Credits:Special thanks to @mithmatt for adding this problem and cre 阅读全文
posted @ 2018-03-21 15:05 __Meng 阅读(102) 评论(0) 推荐(0)
摘要:Given a binary search tree (BST) with duplicates, find all the mode(s) (the most frequently occurred element) in the given BST. Assume a BST is define 阅读全文
posted @ 2018-03-21 11:20 __Meng 阅读(174) 评论(0) 推荐(0)
摘要:Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree [1,2,2,3,4,4,3] is symmet 阅读全文
posted @ 2018-03-21 10:46 __Meng 阅读(104) 评论(0) 推荐(0)
摘要:Write a program to find the node at which the intersection of two singly linked lists begins. For example, the following two linked lists: begin to in 阅读全文
posted @ 2018-03-21 10:23 __Meng 阅读(153) 评论(0) 推荐(0)
摘要:Given a singly linked list, determine if it is a palindrome. Follow up:Could you do it in O(n) time and O(1) space? 判断单链表是否是回文的 C++(25ms): 阅读全文
posted @ 2018-03-20 16:18 __Meng 阅读(108) 评论(0) 推荐(0)

上一页 1 2 3 4 5 6 7 ··· 12 下一页