You are on page 1of 1

Competitive Coding

January 23, 2021

[9, 6, 5, 0, 8, 2]
Print the array content after ’k’ rotations towards left in O(n).

[5]: a = [int(i) for i in input('Enter values: ').split()]


k = int(input("Enter no of left rotations: "))
n = len(a)

# for i in range(k % n, n):


# print(a[i], end = " ")
# for i in range(0, k % n):
# print(a[i], end = " ")

print(a[k % n: ] + a[0 : k % n])

Enter values: 9 6 5 0 8 2
Enter no of left rotations: 3
[0, 8, 2, 9, 6, 5]
Barua Numbers
- Contains only 1 or 0 - Contains only one 1 and any no of 0’s - it must start with 1
1, 10, 1000, 100000, 1000000000000, 100000000000000000000000000000
There can be only one decimal number 13400000000000000
Result: 10000000 X 1350000 = 135000000000000
[ ]:

You might also like