Why this code is not works? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why this code is not works?

This code gives run time error. why? https://code.sololearn.com/c2PU3O85O5hI

9th Sep 2021, 9:32 AM
˜”*°•.˜”*°• Mohan 333 •°*”˜.•°*”˜
˜”*°•.˜”*°• Mohan 333 •°*”˜.•°*”˜ - avatar
6 Answers
0
˜”*°•.˜”*°• Mohan 333 •°*”˜.•°*”˜ I used and i don't give run time error. What is the input of the code?
12th Sep 2021, 1:45 AM
Benjamin Salas
Benjamin Salas - avatar
0
Benjamin Salas You will be give three integer as main input. t,n,x and you will give n number of numbers which means the n length array of integers. This code is work if t=1 . But it is not work for higher value of t. Sample input: 1 3 2 1 2 3 Output : 2 1 But this code is not working when t>1 Like: 2 5 100 1 2 3 4 5 4 1 2 2 6 6 output : 1 0 2 0
12th Sep 2021, 1:53 AM
˜”*°•.˜”*°• Mohan 333 •°*”˜.•°*”˜
˜”*°•.˜”*°• Mohan 333 •°*”˜.•°*”˜ - avatar
0
For example if you put 2 what is the output? Explain to me the logic
13th Sep 2021, 7:34 PM
Benjamin Salas
Benjamin Salas - avatar
0
Benjamin Salas It is a one of the problems in the codechef September long challenge. link:https://www.codechef.com/problems/PALINT Logic is make an array of n integers to maximum number of equal integers in minimum number of xor operations. Logic in my code is : 1)Take an array of n integers. 2)sort it . 3)And for each element in the array make these actions, * first count the appearances of an element in the array. * then , find the value ( element ^x) in the array using binary search. * then, start counting the appearances of (element ^x) from that position to 0 and position to n in the array. ex: 3 2 // n=3 x=2 1 2 3 // array xor 2 with third element. [1 2 1] -> 2 elements.
14th Sep 2021, 3:11 AM
˜”*°•.˜”*°• Mohan 333 •°*”˜.•°*”˜
˜”*°•.˜”*°• Mohan 333 •°*”˜.•°*”˜ - avatar
18th Oct 2021, 1:50 PM
Benjamin Salas
Benjamin Salas - avatar
0
Benjamin Salas no. I did not resolved.
18th Oct 2021, 2:44 PM
˜”*°•.˜”*°• Mohan 333 •°*”˜.•°*”˜
˜”*°•.˜”*°• Mohan 333 •°*”˜.•°*”˜ - avatar