Excel Sheet Column Number
Related to question Excel Sheet Column Title
Given a column title as appear in an Excel sheet, return its corresponding column number.
For example:1
2
3
4
5
6
7A -> 1
B -> 2
C -> 3
...
Z -> 26
AA -> 27
AB -> 28
1 | /** |
Excel Sheet Column Title
Given a positive integer, return its corresponding column title as appear in an Excel sheet.
For example:1
2
3
4
5
6
71 -> A
2 -> B
3 -> C
...
26 -> Z
27 -> AA
28 -> AB
1 | /** |
Factorial Trailing Zeroes
Given an integer n, return the number of trailing zeroes in n!.
Note: Your solution should be in logarithmic time complexity.
1 | /** |
Find All Anagrams in a String
Given a string s and a non-empty string p, find all the start indices of p’s anagrams in s.
Strings consists of lowercase English letters only and the length of both strings s and p will not be larger than 20,100.
The order of output does not matter.
Example 1:1
2
3
4
5
6
7
8
9Input:
s: "cbaebabacd" p: "abc"
Output:
[0, 6]
Explanation:
The substring with start index = 0 is "cba", which is an anagram of "abc".
The substring with start index = 6 is "bac", which is an anagram of "abc".
Example 2:1
2
3
4
5
6
7
8
9
10Input:
s: "abab" p: "ab"
Output:
[0, 1, 2]
Explanation:
The substring with start index = 0 is "ab", which is an anagram of "ab".
The substring with start index = 1 is "ba", which is an anagram of "ab".
The substring with start index = 2 is "ab", which is an anagram of "ab".
1 | ; |
Find All Duplicates in an Array
Given an array of integers, $1 ≤ a[i] ≤ n$ (n = size of array), some elements appear twice and others appear once.
Find all the elements that appear twice in this array.
Could you do it without extra space and in $O(n)$ runtime?
Example:1
2
3
4
5Input:
[4,3,2,7,8,2,3,1]
Output:
[2,3]
1 | /** |