Data Structures & AlgorithmsHardGATE CS · ICPC regional
What is the modular inverse of 3 modulo 11, that is the x in [0, 10] with 3x ≡ 1 (mod 11)?
- A. 5
- B. 6
- C. 4
- D. 8
Correct answer: C. 4
Since 3 * 4 = 12 ≡ 1 (mod 11), the inverse is 4. Extended Euclid gives the same result.
Practise more Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questionsArrays, Strings, Linked Lists, Stacks, Queues and Hashing: notes and key points
More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions
- A cellular automaton of 6 cells starts as [1, 0, 0, 0, 0, 0]. In each step every cell becomes the XOR of its two neighbours (cells outside…
- What is the minimum number of swaps of two (not necessarily adjacent) elements needed to sort the permutation [4, 2, 5, 1, 3] (0-based…
- Which quantity gives the minimum number of arbitrary swaps needed to sort a permutation, and why is it correct?
- Counting ways to pay each amount 0..9 with coins [1, 4, 6]: version A loops over amounts (outer) and coins (inner), counting ordered…
- For the array [4, 2, 5, 3, 1, 6, 0], a 'next greater element' routine returns for each index the value of the next strictly larger element…
- A routine builds a list t: for each x in a, it appends x to t only if x is larger than the last element of t (otherwise it skips x), and…