随笔分类 - LeetCode
摘要:Reverse Vowels of a String Write a function that takes a string as input and reverse only the vowels of a string. Example 1: Given s = "hello", return
阅读全文
摘要:Excel Sheet Column Title Given a positive integer, return its corresponding column title as appear in an Excel sheet. For example: 1 -> A 2 -> B 3 ->
阅读全文
摘要:Reverse String Write a function that takes a string as input and returns the string reversed. Example: Given s = "hello", return "olleh".
阅读全文
摘要:Power of Four Given an integer (signed 32 bits), write a function to check whether it is a power of 4. Example: Given num = 16, return true. Given num
阅读全文
摘要:Integer Break Given a positive integer n, break it into the sum of at least two positive integers and maximize the product of those integers. Return t
阅读全文
摘要:Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in their binary representation and r
阅读全文
摘要:Power of Three Given an integer, write a function to determine if it is a power of three. Follow up: Could you do it without using any loop / recursio
阅读全文
摘要:Bulb Switcher There are n bulbs that are initially off. You first turn on all the bulbs. Then, you turn off every second bulb. On the third round, you
阅读全文
摘要:Missing Number Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array. For example, Give
阅读全文
摘要:Valid Anagram Given two strings s and t, write a function to determine if t is an anagram of s. For example, s = "anagram", t = "nagaram", return true
阅读全文
摘要:Power of Two Given an integer, write a function to determine if it is a power of two.
阅读全文
摘要:Excel Sheet Column Number Related to question Excel Sheet Column Title Given a column title as appear in an Excel sheet, return its corresponding colu
阅读全文
摘要:Contains Duplicate Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at lea
阅读全文
摘要:Majority Element Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. You ma
阅读全文
摘要:Maximum Product Subarray Find the contiguous subarray within an array (containing at least one number)which has the largest product. For example, give
阅读全文
摘要:Product of Array Except Self Given an array of n integers where n > 1, nums, return an array output such that output[i] is equal to the product of all
阅读全文
摘要:Trapping Rain Water Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to
阅读全文
摘要:Container With Most Water Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are dra
阅读全文
摘要:Two Sum Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would
阅读全文
摘要:Nim Game 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
阅读全文

浙公网安备 33010602011771号