随笔分类 - leetcode
https://leetcode.com/problemset/all/
摘要:The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font
阅读全文
摘要:Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example 1: Input: "babad" Output:
阅读全文
摘要:Given a non negative integer num, repeatedly add all its digits until the result has only one digit. Example: Input: 38 Output: 2 Explanation: The pro
阅读全文
摘要:Given an integer (signed 32 bits), write a function to check whether it is a power of 4. Example 1: Input: 16 Output: true Example 2: Input: 5 Output:
阅读全文
摘要:Given an integer, write a function to determine if it is a power of three. Example 1: Input: 27 Output: true Example 2: Input: 0 Output: false Example
阅读全文
摘要:Given a positive integer num, write a function which returns True if num is a perfect square else False. Note: Do not use any built in library functio
阅读全文
摘要:Find the nth digit of the infinite integer sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ... Note: n is positive and will fit within the range of a 32 b
阅读全文
摘要:Write a program to check whether a given number is an ugly number. Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. Example
阅读全文
摘要:Given a list of non negative integers, arrange them such that they form the largest number. Example 1: Input: [10,2] Output: "210" Example 2: Input: [
阅读全文
摘要:Given an unsorted array, find the maximum difference between the successive elements in its sorted form. Return 0 if the array contains less than 2 el
阅读全文
摘要:Given an integer n, return 1 n in lexicographical order. For example, given 13, return: [1,10,11,12,13,2,3,4,5,6,7,8,9]. Please optimize your algorith
阅读全文
摘要:International Morse Code defines a standard encoding where each letter is mapped to a series of dots and dashes, as follows: "a" maps to ". ", "b" map
阅读全文
摘要:In the "100 game," two players take turns adding, to a running total, any integer from 1..10. The player who first causes the running total to reach o
阅读全文
摘要:Given two binary strings, return their sum (also a binary string). The input strings are both non empty and contains only characters 1 or 0. Example 1
阅读全文
摘要:Given a string s consists of upper/lower case alphabets and empty space characters ' ', return the length of last word in the string. If the last word
阅读全文
摘要:A self dividing number is a number that is divisible by every digit it contains. For example, 128 is a self dividing number because 128 % 1 == 0, 128
阅读全文
摘要:The n queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other. Given an integer n, return the
阅读全文
摘要:The n queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other. Given an integer n, return all
阅读全文
摘要:Let's call any (contiguous) subarray B (of A) a mountain if the following properties hold: B.length = 3 There exists some 0 B[i+1] ... B[B.length 1] (
阅读全文
摘要:There is a robot starting at position (0, 0), the origin, on a 2D plane. Given a sequence of its moves, judge if this robot ends up at (0, 0) after it
阅读全文

浙公网安备 33010602011771号