随笔分类 -  leetcode

上一页 1 2 3 4 5 6 7 8 ··· 17 下一页
https://leetcode.com/problemset/all/
摘要:Write a function that takes an unsigned integer and returns the number of '1' bits it has (also known as the Hamming weight). Example 1: Input: 11 Out 阅读全文
posted @ 2018-11-30 15:17 bernieloveslife 阅读(83) 评论(0) 推荐(0)
摘要:Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. (i.e., [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2]). F 阅读全文
posted @ 2018-11-30 15:17 bernieloveslife 阅读(106) 评论(0) 推荐(0)
摘要:Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. (i.e., [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2]). F 阅读全文
posted @ 2018-11-30 15:17 bernieloveslife 阅读(98) 评论(0) 推荐(0)
摘要:Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. push(x) Push element x onto stack. pop() Removes the 阅读全文
posted @ 2018-11-30 15:17 bernieloveslife 阅读(92) 评论(0) 推荐(0)
摘要:Given a non negative integer numRows, generate the first numRows of Pascal's triangle. In Pascal's triangle, each number is the sum of the two numbers 阅读全文
posted @ 2018-11-30 15:16 bernieloveslife 阅读(109) 评论(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: A: a1 → a2 阅读全文
posted @ 2018-11-30 15:16 bernieloveslife 阅读(80) 评论(0) 推荐(0)
摘要:Write a function that takes a string as input and returns the string reversed. Example 1: Input: "hello" Output: "olleh" Example 2: Input: "A man, a p 阅读全文
posted @ 2018-11-30 15:16 bernieloveslife 阅读(74) 评论(0) 推荐(0)
摘要:You have a total of n coins that you want to form in a staircase shape, where every k th row must have exactly k coins. Given n, find the total number 阅读全文
posted @ 2018-11-30 15:16 bernieloveslife 阅读(92) 评论(0) 推荐(0)
摘要:We define the Perfect Number is a positive integer that is equal to the sum of all its positive divisors except itself. Now, given an integer n, write 阅读全文
posted @ 2018-11-30 15:16 bernieloveslife 阅读(117) 评论(0) 推荐(0)
摘要:Given a binary tree, return all root to leaf paths. Note: A leaf is a node with no children. Example: Input: Output: ["1 2 5", "1 3"] Explanation: All 阅读全文
posted @ 2018-11-30 15:16 bernieloveslife 阅读(358) 评论(0) 推荐(0)
摘要:The set S originally contains numbers from 1 to n. But unfortunately, due to the data error, one of the numbers in the set got duplicated to another n 阅读全文
posted @ 2018-11-30 15:16 bernieloveslife 阅读(85) 评论(0) 推荐(0)
摘要:You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you cl 阅读全文
posted @ 2018-11-30 15:16 bernieloveslife 阅读(97) 评论(0) 推荐(0)
摘要:Given a binary tree and a sum, determine if the tree has a root to leaf path such that adding up all the values along the path equals the given sum. N 阅读全文
posted @ 2018-11-30 15:16 bernieloveslife 阅读(93) 评论(0) 推荐(0)
摘要:Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path from the root node down to the nearest l 阅读全文
posted @ 2018-11-30 15:16 bernieloveslife 阅读(70) 评论(0) 推荐(0)
摘要:Given the root node of a binary search tree (BST) and a value. You need to find the node in the BST that the node's value equals the given value. Retu 阅读全文
posted @ 2018-11-30 15:16 bernieloveslife 阅读(98) 评论(0) 推荐(0)
摘要:Given a C++ program, remove comments from it. The program source is an array where source[i] is the i th line of the source code. This represents the 阅读全文
posted @ 2018-11-30 15:16 bernieloveslife 阅读(125) 评论(0) 推荐(0)
摘要:Given an integer n, generate all structurally unique BST's (binary search trees) that store values 1 ... n. Example: Input: 3 Output: [ [1,null,3,2], 阅读全文
posted @ 2018-11-30 15:16 bernieloveslife 阅读(121) 评论(0) 推荐(0)
摘要:We have an array A of non negative integers. For every (contiguous) subarray B = [A[i], A[i+1], ..., A[j]] (with i 阅读全文
posted @ 2018-11-30 15:15 bernieloveslife 阅读(332) 评论(0) 推荐(0)
摘要:Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. For example, two is written as II in Roman numeral, just two one's 阅读全文
posted @ 2018-11-30 15:15 bernieloveslife 阅读(98) 评论(0) 推荐(0)
摘要:Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. Symbol Value I 1 V 5 X 10 L 50 C 100 D 500 M 1000 For example, two 阅读全文
posted @ 2018-11-30 15:15 bernieloveslife 阅读(96) 评论(0) 推荐(0)

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