"078-subsets (subset)""leetcode-Interview algorithm classic-java Implementation" "All topics Directory Index"Original QuestionGiven a set of distinct integers, nums, return all possible subsets.Note:Elements in a subset must is in non-descending order.The solution set must not contain duplicate subsets.For example,If nums = [A/b], a solution is:[ [3], [1], [2], [1,2,3], [1,3], [2,3], [1,2], []]Main
079-word Search (Word search)"leetcode-Interview algorithm classic-java Implementation" "All topics Directory Index"Original QuestionGiven a 2D board and a word, find if the word exists in the grid.The word can be constructed from letters of sequentially adjacent cell, where "adjacent" cells is those horizontally or V Ertically neighboring. The same letter cell is used more than once.For example,Given board
"098-validate binary search Tree""leetcode-Interview algorithm classic-java Implementation" "All topics Directory Index"Original QuestionGiven a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtree of a node contains only nodes with keys less than the node ' s key.The right subtree of a node contains only nodes with keys greater than the node '
"088-merge Sorted Array (merge sorted array)""leetcode-Interview algorithm classic-java Implementation" "All topics Directory Index"Original QuestionGiven sorted integer Arrays nums1 and nums2, merge nums2 into nums1 as one sorted array. Note:Assume that nums1 have enough space (size that's greater or equal to M + N) to hold additional elements from NUMS2 . The number of elements initialized in Nums1 and N
"089-gray Code (Gray code)""leetcode-Interview algorithm classic-java Implementation" "All topics Directory Index"Original QuestionThe gray code is a binary numeral system where the successive values are differ in only one bit.Given a non-negative integer n representing the total number of bits in the code, print the sequence of gray code. A Gray code sequence must begin with 0.For example, given n = 2, ret
"057-insert Interval (insertion interval)""leetcode-Interview algorithm classic-java Implementation" "All topics Directory Index"Original QuestionGiven a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary).Assume that the intervals were initially sorted according to their start times.Example 1:Given intervals [1,3],[6,9] , insert and merge in as [2,5] [1,5],[6,9]
"058-length of last word (length of final word)""leetcode-Interview algorithm classic-java Implementation" "All topics Directory Index"Original QuestionGiven A string s consists of Upper/lower-case alphabets and empty space characters ‘ ‘ , return the length of last word I n the string.If the last word does not exist, return 0.Note:a word is defined as A character sequence consists for non-space characters
054-spiral matrix (spiral matrix)"leetcode-Interview algorithm classic-java Implementation" "All topics Directory Index"Original QuestionGiven a matrix of M x n elements (m rows, n columns), return all elements of the matrix in spiral order.For example,Given the following matrix:123456789 ]]You should return [1,2,3,6,9,8,7,4,5] .Main TopicGiven a m*n matrix, enter the spiral order of all the elements.Thinki
"056-merge intervals (interval merger)""leetcode-Interview algorithm classic-java Implementation" "All topics Directory Index"Original QuestionGiven a collection of intervals, merge all overlapping intervals.For example,Given [1,3],[2,6],[8,10],[15,18] ,Return [1,6],[8,10],[15,18] .Main TopicGiven a set of intervals, the overlapping intervals are merged.Thinking of solving problemsThe interval is sorted fir
"077-combinations (number of combinations)""leetcode-Interview algorithm classic-java Implementation" "All topics Directory Index"Original QuestionGiven-integers n and K, return all possible combinations of k numbers out of 1 ... n.For example,If n = 4 and k = 2, a solution is:[ [2,4], [3,4], [2,3], [1,2], [1,3], [1,4],]Main TopicGiven two numbers n and K, all combinations of k numbers from 1-n are ob
"125-valid palindrome (back to text verification)""leetcode-Interview algorithm classic-java Implementation" "All topics Directory Index"Original QuestionGiven a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example, "A man, a plan, a canal: Panama"is a palindrome. "race a car"is not a palindrome. Note:Are you consider that the string might is em
"119-pascal ' s Triangle II (Pascal triangle (Yang Hui triangle) II)""leetcode-Interview algorithm classic-java Implementation" "All topics Directory Index"Original QuestionGiven an index k, return the kth row of the Pascal ' s triangle.For example, given k = 3,Return [1,3,3,1] . Note:Could optimize your algorithm to use only O (k) extra space?Main TopicGiven a positive integer k, the K-line of Pascal is o
"226-invert binary tree (reverse two fork)""leetcode-Interview algorithm classic-java Implementation" "All topics Directory Index"code Download "Https://github.com/Wang-Jun-Chao"Original QuestionInvert a binary tree. 4 / 2 \ 1 3 6 9To 4 / 7 \ 9 6 3 1Main TopicFlips a binary tree.Thinking of solving problemsFor each node, the left and right sub-tree is exchanged, and t
"225-implement stack using Queues (stack operation with queues)""leetcode-Interview algorithm classic-java Implementation" "All topics Directory Index"code Download "Https://github.com/Wang-Jun-Chao"Original QuestionImplement the following operations of a stack using queues.Push (x) –push element x onto stack.Pop () –removes the element on top of the stack.Top () –get the top element.Empty () –return whethe
"138-copy list with random Pointer (copy of single-linked list with random pointers)""leetcode-Interview algorithm classic-java Implementation" "All topics Directory Index"Original QuestionA linked list is given such this each node contains an additional random pointer which could point to all node in the list or null.Return a deep copy of the list.Main TopicA single-linked list contains a node pointer that
"144-binary Tree Preorder Traversal (binary tree non-recursive pre-sequence traversal)""leetcode-Interview algorithm classic-java Implementation" "All topics Directory Index"Original QuestionGiven a binary tree, return the preorder traversal of its nodes ' values.For example:Given binary Tree {1,#,2,3} , 1 2 / 3Return [1,2,3] .Note:recursive solution is trivial, could do it iteratively?Main
"145-binary Tree postorder Traversal (binary tree non-recursive post-traversal)""leetcode-Interview algorithm classic-java Implementation" "All topics Directory Index"Original QuestionGiven a binary tree, return the postorder traversal of its nodes ' values.For example:Given binary Tree {1,#,2,3} , 1 2 / 3Return [3,2,1] .Note:recursive solution is trivial, could do it iteratively?Main TopicGi
[LeetCode-interview algorithm classic-Java implementation] [020-Valid Parentheses (bracket verification)],-javaparentheses [020-Valid Parentheses (bracket verification )][LeetCode-interview algorithm classic-Java implementation] [directory indexes for all questions]Original question
Given a string containing just the c
[LeetCode-interview algorithm classic-Java implementation] [033-Search in Rotated Sorted Array (Search in the rotating Array)],-javarotated [033-Search in Rotated Sorted Array (Search in Rotated Array )][LeetCode-interview algorithm classic-Java implementation] [directory indexes for all questions]Original question
Sup
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.