Skip to content

jawadsab/GoogleCodingInterview

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

GoogleCodingInterview

Selected Google interview programs. #1 Given an array A of N positive integers and another number X. Determine whether or not there exist two elements in A whose sum is exactly X.

Input: 6 16 1 4 45 6 10 8 Output: Yes

#2 A magic number is defined as a number which can be expressed as a power of 5 or sum of unique powers of 5. First few magic numbers are 5, 25, 30(5 + 25), 125, 130(125 + 5), …. Write a function to find the nth Magic number.

Input: n = 2 Output: 25

Input: n = 5 Output: 130

#3 A number is called faithful if you can write it as the sum of distinct powers of 7. e.g., 2457 = 7 + 72 + 74 . If we order all the faithful numbers, we get the sequence 1 = 70, 7 = 71, 8 = 70 + 71, 49 = 72, 50 = 70 + 72 . . . and so on. Given some value of N, you have to find the N'th faithful number.

About

Selected Google interview programs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages