Skip to content

Latest commit

 

History

History
62 lines (45 loc) · 1.31 KB

File metadata and controls

62 lines (45 loc) · 1.31 KB

assignment-2 : B.tech CSE 1st Year Batch (session 2019-2020)

GLAU TND

use python3 for all solutions

Problem 1

This problem was asked by Dropbox.

Given a list of words, determine whether the words can be chained to form a circle. 
A word X can be placed in front of another word Y in a circle if the last character 
of X is same as the first character of Y.

For example, 
the words ['chair', 'height', 'racket', touch', 'tunic'] 
can form the following circle: 

chair --> racket --> touch --> height --> tunic --> chair 

list is entered by user directly in the form of list of words

sample input
['chair', 'height', 'racket', touch', 'tunic']

sample output
['chair', 'racket', 'touch', 'height', 'tunic']

Problem 2

This problem was asked by Twitter.

Given a list of numbers, create an program that arranges 
them in order to form the largest possible integer. 
For example, 
given [10, 7, 76, 415], you should print 77641510

sample input
[10, 7, 76, 415]
sample output
77641510

Problem 3

This problem was asked by Stripe.

Given an integer n, return the length of the longest 
consecutive run of 1s in its binary representation.
For example, given 156, you should return 3

explanation 
binary of 156 (bin(156)) is '0b10011100'
there are max consecutive 1s is 3 

sample input
12
sample output
2