Question from a Sprinklr interview

Revision en2, by guptaji30, 2022-01-20 10:56:56

Given an array, arr[] of integers. The task is to sort the elements of the given array in the increasing order of their modulo with 3 maintaining the order of their appearance.

Expect time complexity O(N) and the interviewer said that it can be done in only one/two traversal(s)(sorry I don't remember it clearly, it was quite sometime ago).

Expected space complexity O(1).

Tags array, sorting, interview

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English guptaji30 2022-01-20 10:56:56 70
en1 English guptaji30 2022-01-20 07:32:10 348 Initial revision (published)