Can someone tell me what wrong with this code. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Can someone tell me what wrong with this code.

Chef has an array consisting of N+K−1N+K−1 integers. The array contains only the first NN positive odd numbers. Each number appears exactly once, except for one number which appears exactly KK times. The sum of integers in Chef's array is equal to SS. For example, for N=3N=3, K=2K=2, the possible arrays could be [1,1,3,5][1,1,3,5], [3,1,3,5][3,1,3,5], [5,3,5,1][5,3,5,1]. For N=1N=1, K=3K=3, there is only one possible array: [1,1,1][1,1,1]. Chef gives you three integers NN, KK and SS and asks you to find the only element which appears KK times in his array. It is guaranteed that for the given input, there exists a valid array consisting of N+K−1N+K−1 elements with a sum exactly equal to S . Output Format For each test case, print a single line containing the integer which repeated k times. https://code.sololearn.com/c32AO18FI1fk/?ref=app

29th Aug 2021, 1:36 PM
Lucifer 👩‍💻
Lucifer 👩‍💻 - avatar
5 Answers
+ 5
Code or code link should be in description part not in the question title
29th Aug 2021, 1:38 PM
Abhay
Abhay - avatar
+ 1
Lucifer 👩‍💻 can you format the code so it is somewhat readable ? And why are you repeating everything in your question twice ? Is it intentional or something we should know about ?
29th Aug 2021, 8:29 PM
Abhay
Abhay - avatar
0
Actually, when i am writing this post i'm experiencing a glitch. That's why some words gets repeated twice.So,every word that's repeated is actually alone.
31st Aug 2021, 4:04 PM
Lucifer 👩‍💻
Lucifer 👩‍💻 - avatar
0
I had already written the question in description section and also added the link in same.
31st Aug 2021, 4:08 PM
Lucifer 👩‍💻
Lucifer 👩‍💻 - avatar
0
What happened Abhay.
12th Sep 2021, 8:01 AM
Lucifer 👩‍💻
Lucifer 👩‍💻 - avatar