-
-
Save youngershen/30479117c4d8a6eafb83818add71a7f7 to your computer and use it in GitHub Desktop.
Blockchain Interview quiz 101
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Q1 | |
Convert a non-negative integer num to its English words representation. | |
Example 1: | |
Input: num = 123 | |
Output: "One Hundred Twenty Three" | |
Example 2: | |
Input: num = 12345 | |
Output: "Twelve Thousand Three Hundred Forty Five" | |
Example 3: | |
Input: num = 1234567 | |
Output: "One Million Two Hundred Thirty Four Thousand Five Hundred Sixty Seven" | |
Example 4: | |
Input: num = 1234567891 | |
Output: "One Billion Two Hundred Thirty Four Million Five Hundred Sixty Seven Thousand Eight Hundred Ninety One" | |
Constraints: | |
0 <= num <= 231 - 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Q2 | |
You are given a string s and an array of strings words of the same length. Return all starting indices of substring(s) in s that is a concatenation of each word in words exactly once, in any order, and without any intervening characters. | |
You can return the answer in any order. | |
Example 1: | |
Input: s = "barfoothefoobarman", words = ["foo","bar"] | |
Output: [0,9] | |
Explanation: Substrings starting at index 0 and 9 are "barfoo" and "foobar" respectively. | |
The output order does not matter, returning [9,0] is fine too. | |
Example 2: | |
Input: s = "wordgoodgoodgoodbestword", words = ["word","good","best","word"] | |
Output: [] | |
Example 3: | |
Input: s = "barfoofoobarthefoobarman", words = ["bar","foo","the"] | |
Output: [6,9,12] | |
Constraints: | |
1 <= s.length <= 104 | |
s consists of lower-case English letters. | |
1 <= words.length <= 5000 | |
1 <= words[i].length <= 30 | |
words[i] consists of lower-case English letters. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A1
A2