随笔分类 - LeetCode
摘要:题目描述:(链接)You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove 1 ...
阅读全文
摘要:题目描述:(链接)The gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integernrepresenting the tot...
阅读全文
摘要:题目链接:(链接)You are climbing a stair case. It takesnsteps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can ...
阅读全文
摘要:题目描述:(链接)Given a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the most significant di...
阅读全文
摘要:题目描述:(链接)You are given annxn2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Follow up:Could you do this in-place?解题思路:先将矩阵选...
阅读全文
摘要:题目描述:(链接)Given apatternand a stringstr, find ifstrfollows the same pattern.Herefollowmeans a full match, such that there is a bijection between a lett...
阅读全文
摘要:题目描述:(链接)Givennnon-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after r...
阅读全文
摘要:题目描述:(链接)Determine if a Sudoku is valid, according to:Sudoku Puzzles - The Rules.The Sudoku board could be partially filled, where empty cells are fil...
阅读全文
摘要:题目描述:(链接)The set[1,2,3,…,n]contains a total ofn! unique permutations.By listing and labeling all of the permutations in order,We get the following seq...
阅读全文
摘要:题目描述:(链接)Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.If such arrangement is no...
阅读全文
摘要:题目描述:(链接)Given an arraySofnintegers, are there elementsa,b,c, anddinSsuch thata+b+c+d= target? Find all unique quadruplets in the array which gives th...
阅读全文
摘要:题目描述:(链接)Given an arraySofnintegers, find three integers inSsuch that the sum is closest to a given number, target. Return the sum of the three intege...
阅读全文
摘要:题目描述:(链接)Given an arraySofnintegers, are there elementsa,b,cinSsuch thata+b+c= 0? Find all unique triplets in the array which gives the sum of zero.No...
阅读全文
摘要:题目描述:(链接)Given an unsorted array of integers, find the length of the longest consecutive elements sequence.For example,Given[100, 4, 200, 1, 3, 2],The...
阅读全文
摘要:题目描述:(题目链接)There are two sorted arraysnums1andnums2of size m and n respectively. Find the median of the two sorted arrays. The overall run time comple...
阅读全文
摘要:题目描述:(链接)Follow up for "Search in Rotated Sorted Array":What ifduplicatesare allowed?Would this affect the run-time complexity? How and why?Write a fu...
阅读全文
摘要:题目描述:(链接)Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e.,0 1 2 4 5 6 7might become4 5 6 7 0 1 2).You are given a targe...
阅读全文
摘要:题目描述:(链接)Follow up for "Remove Duplicates":What if duplicates are allowed at mosttwice?For example,Given sorted arraynums=[1,1,1,2,2,3],Your function ...
阅读全文
摘要:题目描述:(https://leetcode.com/problems/remove-duplicates-from-sorted-array/)Given a sorted array, remove the duplicates in place such that each element a...
阅读全文
摘要:题目描述:Given a singly linked listL:L0→L1→…→Ln-1→Ln,reorder it to:L0→Ln→L1→Ln-1→L2→Ln-2→…You must do this in-place without altering the nodes' values.For...
阅读全文

浙公网安备 33010602011771号