题目链接:Dungeon GameThe demons had captured the princess (P) and imprisoned her in the bottom-right corner of a dungeon. The dungeon consists of M x N rooms laid out in a...
More »
题目链接:Binary Search Tree IteratorImplement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST.Calling next() wil...
More »
题目链接:Factorial Trailing ZeroesGiven an integer n, return the number of trailing zeroes in n!.Note: Your solution should be in logarithmic time complexity.这道题的要求是统计n!(n...
More »
题目链接:Excel Sheet Column NumberRelated to question Excel Sheet Column TitleGiven a column title as appear in an Excel sheet, return its corresponding column number.For ...
More »
题目链接:Majority ElementGiven an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.You may assume that ...
More »
题目链接:Excel Sheet Column TitleGiven a positive integer, return its corresponding column title as appear in an Excel sheet.For example: 1 -> A 2 -> B 3 -&...
More »
题目链接:Fraction to Recurring DecimalGiven two integers representing the numerator and denominator of a fraction, return the fraction in string format.If the fractional p...
More »
题目链接:Compare Version NumbersCompare two version numbers version1 and version2.If version1 > version2 return 1, if version1 < version2 return -1, otherwise return...
More »
题目链接:Maximum GapGiven an unsorted array, find the maximum difference between the successive elements in its sorted form.Try to solve it in linear time/space.Return 0 i...
More »
题目链接:Find Peak ElementA peak element is an element that is greater than its neighbors.Given an input array where num[i] ≠ num[i+1], find a peak element and return its ...
More »