随笔分类 - 刷题进行时
摘要:No.223 Rectangle AreaFind the total area covered by tworectilinearrectangles in a2Dplane.Each rectangle is defined by its bottom left corner and top r...
阅读全文
摘要:No.66 Plus OneGiven a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the most significa...
阅读全文
摘要:Remove Duplicates from Sorted Array||Follow up for "Remove Duplicates":What if duplicates are allowed at mosttwice?For example,Given sorted arraynums=...
阅读全文
摘要:No.27 Remove ElementGiven an array and a value, remove all instances of that value in place and return the new length.The order of elements can be cha...
阅读全文
摘要:Remove Duplicates from Sorted ArrayGiven a sorted array, remove the duplicates in place such that each element appear onlyonceand return the new lengt...
阅读全文
摘要:No.9 Palindrome NumberDetermine whether an integer is a palindrome. Do this without extra space.click to show spoilers.Some hints:Could negative integ...
阅读全文
摘要:No.219 Contains Duplicate ||Given an array of integers and an integerk, find out whether there there are two distinct indicesiandjin the array such th...
阅读全文
摘要:No.205 Ismorphic StringsGiven two stringssandt, determine if they are isomorphic.Two strings are isomorphic if the characters inscan be replaced to ge...
阅读全文
摘要:No.217 Contains DuplicateGiven an array of integers, find if the array contains any duplicates. Your function should return true if any value appears ...
阅读全文
摘要:No.14 Longest Common PrefixWrite a function to find the longest common prefix string amongst an array of strings.求一组string的最长公共前缀想法:找到最短的那个,然后依次对比典型的字...
阅读全文
摘要:No.118 Pascal's Triangle ||Given an indexk, return thekthrow of the Pascal's triangle.For example, givenk= 3,Return[1,3,3,1].思路: 生成帕斯卡三角形第rowIndex+1行...
阅读全文
摘要:No.118 Pascal's TriangleGivennumRows, generate the firstnumRowsof Pascal's triangle.For example, givennumRows= 5,Return[ [1], [1,1], [1,2,1],...
阅读全文
摘要:No.179 Largest NumberGiven a list of non negative integers, arrange them such that they form the largest number.For example, given[3, 30, 34, 5, 9], t...
阅读全文
摘要:No.56 Merge IntervalsGiven a collection of intervals, merge all overlapping intervals.For example,Given[1,3],[2,6],[8,10],[15,18],return[1,6],[8,10],[...
阅读全文
摘要:No.57 Insert IntervalGiven a set ofnon-overlappingintervals, insert a new interval into the intervals (merge if necessary).You may assume that the int...
阅读全文
摘要:No.164 Maximum GapGiven an unsorted array, find the maximum difference between the successive elements in its sorted form.Try to solve it in linear ti...
阅读全文
摘要:No.75 Sort ColorsGiven an array withnobjects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in ...
阅读全文
摘要:No.28 Implement strStr()Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.分析...
阅读全文
摘要:No.58 Length of Last WordGiven a stringsconsists of upper/lower-case alphabets and empty space characters' ', return the length of last word in the st...
阅读全文
摘要:No.6 ZigZag ConversionThe string"PAYPALISHIRING"is written in a zigzag pattern on a given number of rows like this: (you may want to display this patt...
阅读全文

浙公网安备 33010602011771号