LeetCode
csu54zzg
这个作者很懒,什么都没留下…
展开
-
Posts Tagged 【list】Reverse Linked List
Reverse Linked List Total Accepted: 4127 Total Submissions: 11587My SubmissionsQuestion Solution Reverse a singly linked list./** * Definition for singly-linked list. * publi原创 2015-05-07 10:18:23 · 388 阅读 · 0 评论 -
Posts Tagged 【bfs】Binary Tree Level Order Traversal I && II
Binary Tree Level Order Traversal Total Accepted: 47754 Total Submissions: 161177My SubmissionsQuestion Solution Given a binary tree, return the level order traversal of its node原创 2015-04-26 22:21:02 · 352 阅读 · 0 评论 -
Posts Tagged 【String】 Text Justification
Text Justification Total Accepted: 18124 Total Submissions: 125685My SubmissionsQuestion Solution Given an array of words and a length L, format the text such that each line has原创 2015-04-30 16:02:52 · 520 阅读 · 0 评论 -
Posts Tagged 【List】Swap Nodes in Pairs
Swap Nodes in Pairs Total Accepted: 45650 Total Submissions: 140545My SubmissionsQuestion Solution Given a linked list, swap every two adjacent nodes and return its head.For ex原创 2015-04-30 16:30:50 · 360 阅读 · 0 评论 -
Posts Tagged 【math】Valid Sudoku
Valid Sudoku Total Accepted: 33528 Total Submissions: 122751My SubmissionsQuestion Solution Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules.The Sudoku原创 2015-05-02 15:22:50 · 342 阅读 · 0 评论 -
Posts Tagged 【math】Count Primes
Count Primes Total Accepted: 3 Total Submissions: 73My SubmissionsQuestion Solution Description:Count the number of prime numbers less than a non-negative number, nHint: The原创 2015-04-27 12:50:40 · 482 阅读 · 0 评论 -
Posts Tagged 【math】Max Points on a Line
Max Points on a Line Total Accepted: 35386 Total Submissions: 287709My SubmissionsQuestion Solution Given n points on a 2D plane, find the maximum number of points that lie on th原创 2015-05-02 15:17:26 · 467 阅读 · 0 评论 -
Posts Tagged 【List】Remove Linked List Elements
Remove Linked List Elements Total Accepted: 4504 Total Submissions: 16723My SubmissionsQuestion Solution Remove all elements from a linked list of integers that have value val.原创 2015-04-27 13:02:30 · 334 阅读 · 0 评论 -
Posts Tagged 【math】Happy Number
Happy Number Total Accepted: 4647 Total Submissions: 14429My SubmissionsQuestion Solution Write an algorithm to determine if a number is "happy".A happy number is a number defi原创 2015-04-27 13:46:01 · 413 阅读 · 0 评论 -
Posts Tagged 【bit】Number of 1 Bits
Number of 1 Bits Total Accepted: 24515 Total Submissions: 66387My SubmissionsQuestion Solution Write a function that takes an unsigned integer and returns the number of ’1' bits原创 2015-04-27 15:37:39 · 321 阅读 · 0 评论 -
Posts Tagged 【bfs】Maximum && Minimum Depth of Binary Tree
Maximum Depth of Binary Tree Total Accepted: 62009 Total Submissions: 137555My SubmissionsQuestion Solution Given a binary tree, find its maximum depth.The maximum depth is the原创 2015-04-30 19:14:49 · 436 阅读 · 0 评论 -
Posts Tagged 【bit】Reverse Bits
Reverse Bits Total Accepted: 17853 Total Submissions: 64347My SubmissionsQuestion Solution Reverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (r原创 2015-04-27 23:54:27 · 340 阅读 · 0 评论 -
Posts Tagged 【hashMap && Double Linked List】LRU Cache
LRU Cache Total Accepted: 37708 Total Submissions: 253143My SubmissionsQuestion Solution Design and implement a data structure for Least Recently Used (LRU) cache. It should supp原创 2015-05-06 22:51:38 · 792 阅读 · 0 评论 -
Posts Tagged 【array && sort】Merge Intervals
Merge Intervals Total Accepted: 33631 Total Submissions: 150861My SubmissionsQuestion Solution Given a collection of intervals, merge all overlapping intervals.For example,Gi原创 2015-05-05 23:34:11 · 314 阅读 · 0 评论 -
Posts Tagged 【List】Anagrams
Anagrams Total Accepted: 34386 Total Submissions: 141041My SubmissionsQuestion Solution Given an array of strings, return all groups of strings that are anagrams.Note: All inpu原创 2015-05-02 00:00:26 · 382 阅读 · 0 评论 -
Posts Tagged 【list && tree && dfs】Flatten Binary Tree to Linked List
Flatten Binary Tree to Linked List Total Accepted: 45579 Total Submissions: 158362My SubmissionsQuestion Solution Given a binary tree, flatten it to a linked list in-place.For原创 2015-05-05 10:11:27 · 368 阅读 · 0 评论 -
Posts Tagged 【tree && dfs】Sum Root to Leaf Numbers
Sum Root to Leaf Numbers Total Accepted: 42534 Total Submissions: 140130My SubmissionsQuestion Solution Given a binary tree containing digits from 0-9 only, each root-to-leaf p原创 2015-05-01 14:01:34 · 429 阅读 · 0 评论 -
Posts Tagged 【math】Sudoku Solver
Sudoku Solver Total Accepted: 26308 Total Submissions: 121888My SubmissionsQuestion Solution Write a program to solve a Sudoku puzzle by filling the empty cells.Empty cells are原创 2015-05-02 23:11:29 · 391 阅读 · 0 评论 -
Posts Tagged 【String】 Isomorphic Strings
Isomorphic Strings Total Accepted: 2968 Total Submissions: 11949My SubmissionsQuestion Solution Given two strings s and t, determine if they are isomorphic.Two strings are isom原创 2015-05-01 21:52:51 · 443 阅读 · 0 评论 -
Posts Tagged 【tree && dfs】
Same Tree Total Accepted: 56272 Total Submissions: 133925My SubmissionsQuestion Solution Given two binary trees, write a function to check if they are equal or not.Two binary t原创 2015-04-14 11:51:17 · 369 阅读 · 0 评论 -
Posts Tagged 【Catalan && dfs】Unique Binary Search Trees I && II
Unique Binary Search Trees Total Accepted: 47048 Total Submissions: 129376My SubmissionsQuestion Solution Given n, how many structurally unique BST's (binary search trees) that s原创 2015-05-01 10:54:33 · 446 阅读 · 0 评论 -
Posts Tagged 【bit】Bitwise AND of Numbers Range
Bitwise AND of Numbers Range Total Accepted: 5165 Total Submissions: 19617My SubmissionsQuestion Solution Given a range [m, n] where 0 For example, given the range [5, 7], you原创 2015-04-27 15:33:38 · 438 阅读 · 0 评论 -
Posts Tagged 【dp】Climbing Stairs
Climbing Stairs Total Accepted: 50798 Total Submissions: 148662My SubmissionsQuestion Solution You are climbing a stair case. It takes n steps to reach to the top.Each time you原创 2015-04-29 20:46:00 · 305 阅读 · 0 评论 -
Posts Tagged 【String】 Reverse Words in a String
Reverse Words in a String Total Accepted: 60944 Total Submissions: 406484My SubmissionsQuestion Solution Given an input string, reverse the string word by word.For example,Gi原创 2015-04-25 18:38:08 · 322 阅读 · 0 评论 -
Posts Tagged 【String】
Excel Sheet Column Title Total Accepted: 21824 Total Submissions: 122722My SubmissionsQuestion Solution Given a positive integer, return its corresponding column title as appear原创 2015-04-15 21:04:05 · 342 阅读 · 0 评论 -
Posts Tagged 【dp】Jump Game II
Jump Game II Total Accepted: 34513 Total Submissions: 141130My SubmissionsQuestion Solution Given an array of non-negative integers, you are initially positioned at the first ind原创 2015-04-12 23:29:11 · 318 阅读 · 0 评论 -
Posts Tagged 【Arrays】Insert Interval
Insert Interval Total Accepted: 30456 Total Submissions: 143835My SubmissionsQuestion Solution Given a set of non-overlapping intervals, insert a new interval into the intervals原创 2015-04-23 22:55:20 · 286 阅读 · 0 评论 -
Simplify Path
Simplify Path Total Accepted: 25684 Total Submissions: 128167My SubmissionsQuestion Solution Given an absolute path for a file (Unix-style), simplify it.For example,path = "/原创 2015-04-13 13:06:04 · 317 阅读 · 0 评论 -
Add Binary
Add Binary Total Accepted: 38531 Total Submissions: 155087My SubmissionsQuestion Solution Given two binary strings, return their sum (also a binary string).For example,a = "1原创 2015-04-13 14:44:25 · 292 阅读 · 0 评论 -
Permutation Sequence
Permutation Sequence Total Accepted: 27012 Total Submissions: 118954My SubmissionsQuestion Solution The set [1,2,3,…,n] contains a total of n! unique permutations.By listing原创 2015-04-12 11:39:33 · 493 阅读 · 0 评论 -
Reverse Linked List II
Reverse Linked List II Total Accepted: 36085 Total Submissions: 137566My SubmissionsQuestion Solution Reverse a linked list from position m to n. Do it in-place and in one-pass.原创 2015-04-07 19:31:29 · 253 阅读 · 0 评论 -
Posts Tagged 【fsm】 Valid Number
Valid Number Total Accepted: 24695 Total Submissions: 216249My SubmissionsQuestion Solution Validate if a given string is numeric.Some examples:"0" => true" 0.1 " => true原创 2015-04-19 18:35:41 · 670 阅读 · 0 评论 -
Posts Tagged 【dp】Interleaving String
Interleaving String Total Accepted: 29109 Total Submissions: 141918My SubmissionsQuestion Solution Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2.原创 2015-04-22 19:24:34 · 321 阅读 · 0 评论 -
Posts Tagged 【List 】Reorder List
Reorder List Total Accepted: 37888 Total Submissions: 180454My SubmissionsQuestion Solution Given a singly linked list L: L0→L1→…→Ln-1→Ln,reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→…原创 2015-04-23 23:50:57 · 412 阅读 · 0 评论 -
Posts Tagged 【Array】
Set Matrix Zeroes Total Accepted: 33316 Total Submissions: 105958My SubmissionsQuestion Solution Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do原创 2015-04-16 13:41:47 · 332 阅读 · 0 评论 -
Posts Tagged 【dfs】Restore IP Addresses
Restore IP Addresses Total Accepted: 30274 Total Submissions: 145054My SubmissionsQuestion Solution Given a string containing only digits, restore it by returning all possible va原创 2015-04-25 15:11:33 · 384 阅读 · 0 评论 -
Posts Tagged 【dfs】Number of Islands
Number of Islands Total Accepted: 5548 Total Submissions: 26482My SubmissionsQuestion Solution Given a 2d grid map of '1's (land) and '0's (water), count the number of islands.原创 2015-04-26 23:56:52 · 376 阅读 · 0 评论 -
Posts Tagged 【dfs】Generate Parentheses
Generate Parentheses Total Accepted: 41747 Total Submissions: 128780My SubmissionsQuestion Solution Given n pairs of parentheses, write a function to generate all combinations of原创 2015-04-20 22:03:37 · 453 阅读 · 0 评论 -
Posts Tagged 【Search】
Find Minimum in Rotated Sorted Array Total Accepted: 38231 Total Submissions: 115773My SubmissionsQuestion Solution Suppose a sorted array is rotated at some pivot unknown to you原创 2015-04-16 17:32:11 · 387 阅读 · 0 评论 -
Posts Tagged 【Math】
Divide Two Integers Total Accepted: 34460 Total Submissions: 225991My SubmissionsQuestion Solution Divide two integers without using multiplication, division and mod operator.I原创 2015-04-16 23:11:02 · 358 阅读 · 0 评论