摘要:
You are given annxn2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Follow up:Could you do this in-place?思路:将这个矩阵沿左对角线(从左上角到... 阅读全文
摘要:
Given a set of distinct integers,nums, return all possible subsets.Note:Elements in a subset must be in non-descending order.The solution set must not... 阅读全文
摘要:
Given a string containing just the characters'(',')','{','}','['and']', determine if the input string is valid.The brackets must close in the correct ... 阅读全文
摘要:
Given an array of strings, group anagrams together.For example, given:["eat", "tea", "tan", "ate", "nat", "bat"],Return:[ ["ate", "eat","tea"], ["na... 阅读全文
摘要:
Given an arraynumscontainingn+ 1 integers where each integer is between 1 andn(inclusive), prove that at least one duplicate number must exist. Assume... 阅读全文
摘要:
Mergeksorted linked lists and return it as one sorted list. Analyze and describe its complexity.思路:构建一个大小为K的小顶堆。每次从堆顶取走一个元素后,都将这个元素所属的链表中下一个元素加入堆中。若没有... 阅读全文
摘要:
Given 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 n... 阅读全文
摘要:
Given a binary tree, return thelevel ordertraversal of its nodes' values. (ie, from left to right, level by level).For example:Given binary tree{3,9,2... 阅读全文