As there can be only 3 remainders
Stack < Integer > ones = new Stack < Integer > ( ) ; Stack < Integer > zeros = new Stack < Integer > ( ) ; Stack < Integer > twos = new Stack < Integer > ( ) ; c_0 = 0 ; c_1 = 0 ; c_2 = 0 ; count_k ( arr , ones , twos , zeros ) ;