標籤:: Math

0

Word Pattern

Word PatternGiven a pattern and a string str, find if str follows the same pattern. Here follow means a full match, such that there is a bijection between a letter in pattern and a non-empty word in

0

Move Zeroes

Move ZeroesGiven an array nums, write a function to move all 0’s to the end of it while maintaining the relative order of the non-zero elements. For example:1Given nums = [0, 1, 0, 3, 12], after call

0

Missing Number

Missing NumberGiven an array containing n distinct numbers taken from 0, 1, 2, …, n, find the one that is missing from the array. For example:1Given nums = [0, 1, 3] return 2. Note: Your algorithm sh

0

Ugly Number

Ugly NumberWrite 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. For example, 6, 8 are ugly while 14 is not ug

0

Add Digits

Add DigitsGiven a non-negative integer num, repeatedly add all its digits until the result has only one digit. For example:1Given num = 38, the process is like: 3 + 8 = 11, 1 + 1 = 2. Since 2 has onl

0

Power of Two

Power of TwoGiven an integer, write a function to determine if it is a power of two. 提示 解題應用 Math 規律觀查 BitManipulation AND Default:123func isPowerOfTwo(n int) bool { } 解答思路:一

0

Count Primes

Count PrimesCount the number of prime numbers less than a non-negative number, n. 提示 解題應用 HashTable Array Math 規律觀查 Default:123func countPrimes(n int) int {} 解答思路:非常典型的空間換取時間,因為

0

Happy Number

Happy NumberWrite an algorithm to determine if a number is “happy”. A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of t

0

Factorial Trailing Zeroes

Factorial Trailing ZeroesGiven an integer n, return the number of trailing zeroes in n!. Note: Your solution should be in logarithmic time complexity. 提示 解題應用 Math 觀查規律 Default:123func trai

0

Excel Sheet Column Number

Excel Sheet Column NumberRelated to question Excel Sheet Column Title Given a column title as appear in an Excel sheet, return its corresponding column number. For example:1234567A -> 1B -> 2C

0

Excel Sheet Column Title

Excel Sheet Column TitleGiven a positive integer, return its corresponding column title as appear in an Excel sheet. For Example:12345671 -> A2 -> B3 -> C...26 -> Z27 -> AA28 -> AB

0

Add Binary

Add BinaryGiven two binary strings, return their sum (also a binary string). For Example:123a = "11"b = "1"Return "100". 提示 解題應用 String 觀查規律 Math 觀查規律 Defaul

0

Plus One

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 significant digit is at the head of the list. 提示 解題應用 Ar

0

Roman to Integer

Roman to IntegerGiven a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 to 3999. 提示 解題應用 Math 規律觀察 String 規律觀察 Default:12func romanToInt(s strin

0

Reverse Integer

Reverse IntegerReverse digits of an integer. Exmaple1:1x = 123, return 321 Exmaple2:1x = -123, return -321 Have you thought about this? Here are some good questions to ask before coding. Bonus points

0

Palindrome Number

Palindrome NumberDetermine whether an integer is a palindrome. Do this without extra space. Some hints: Could negative integers be palindromes? (ie, -1) If you are thinking of converting the integer