I think the below line should read: 2^4
means 2
multiplied by itself thrice: 2 * 2 * 2 * 2 = 16
2^3
means2
multiplied by itself thrice:2 * 2 * 2 * 2 = 16
I think the below line should read: 2^4
means 2
multiplied by itself thrice: 2 * 2 * 2 * 2 = 16
2^3
means2
multiplied by itself thrice:2 * 2 * 2 * 2 = 16
Can we please have dark-mode pictures
Here’s my understanding…
Start with an input array, and perform % 60 operation on all components.
input_array = [150, 20, 90, 110, 80]
# input_array[i] % 60 = input_array_mod_60[i]
input_array_mod_60 = [30, 20, 30, 50, 20]
Remember that the modulus (%) operation more or less reveals the “left over” part of clean division. 60 goes into 150 cleanly 3 times, leaving 30 behind, here’s where we get 30. 150 % 60 = 30, 90 % 60 = 30, etc.
When we take two elements whose “leftovers” equal a full 60, we can confidently say that the sum of the two original elements also can be divisible by 60 cleanly.
Sum of arithmetic sequence is not O(n^2). There is no nested loops in this. It is just involves multiplication of n by n and it is a mathematical calculation of n^2. It will still be O(1) and not O(n^2). PLEASE CORRECT THE ARTICLE