摘要:一、题目 Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. Example: Input: [ 1->4->5, 1->3->4, 2->6 ] Out
阅读全文
摘要:一、题目 There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexi
阅读全文
摘要:一、题目 Given an array of strings, group anagrams together. Example: Input: ["eat", "tea", "tan", "ate", "nat", "bat"], Output: [ ["ate","eat","tea"], ["
阅读全文
摘要:一、题目 You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees (clockwise). Note: You have to rotate the image in-place,
阅读全文
摘要:这道题不解释,纯粹是为了延续记录。两行代码。 一、题目 Given two non-negative integers num1 and num2 represented as strings, return the product of num1 and num2, also represente
阅读全文
摘要:一、题目 Given a collection of candidate numbers (candidates) and a target number (target), find all unique combinations in candidates where the candidate
阅读全文
摘要:一、题目 Given a set of candidate numbers (candidates) (without duplicates) and a target number (target), find all unique combinations in candidates where
阅读全文
摘要:一、题目 Determine if a 9x9 Sudoku board is valid. Only the filled cells need to be validated according to the following rules: Each row must contain the
阅读全文
摘要:一、题目 Given an array of integers nums sorted in ascending order, find the starting and ending position of a given target value. Your algorithm's runtim
阅读全文
摘要:一、题目 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
阅读全文
摘要:一、题目 Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers. If such arrangement is not p
阅读全文
摘要:一、题目 Given two integers dividend and divisor, divide two integers without using multiplication, division and mod operator. Return the quotient after d
阅读全文
摘要:一、题目 Given a linked list, swap every two adjacent nodes and return its head. Example: Note: Your algorithm should use only constant extra space. You m
阅读全文
摘要:一、题目 Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. For example, given n = 3, a solution set
阅读全文
摘要:一、题目 Given a linked list, remove the n-th node from the end of list and return its head. Example: Note: Given n will always be valid. 给定一个链接的 list,移除从
阅读全文
摘要:一、题目 Given an array nums of n integers and an integer target, are there elements a, b, c, and d in nums such that a + b + c + d = target? Find all uni
阅读全文
摘要:一、题目 Given an array nums of n integers and an integer target, find three integers in nums such that the sum is closest to target. Return the sum of th
阅读全文
摘要:一、题目 Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent. A mapping of digit
阅读全文
摘要:一、题目 Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique triplets in the array which gives
阅读全文
摘要:一、题目 Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 to 3999. 把给定的整数转换成罗马数字 二、思路 这道题其实跟13题是两个相反的过程,
阅读全文