Codechef Lunchtime Problem INCRDEC

Правка en2, от Rishi_Kant, 2020-06-28 13:01:57

Hi everyone, I am getting WA in codechef lunchtime priblem INCRDEC INCRDEC my code for this is code.

My approach

1.Firstly, I checked that elements of given array are unique or not if unique I print YES and print array in sorted order.

2.If its not unique, I create a Map and update it on encounter frequency more then one and append that element in a new list.

3.I sorted the hashmap and check about the max key, if value of max(key) is greater then 1 print NO.

4.Same I checked the values of rest keys if values are greater then 2 I took a variable, initialize it by 0 and update it to 1.

5.Finally I check if variable if 0 print YES and reversely sort the list which I create in map and marge it with set.

please help me in finding my fault, please provide any testcase where my code going wrong. Thanks alot.

Теги #codechef, codechef lunchtime, #help

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский Rishi_Kant 2020-06-28 13:01:57 2
en1 Английский Rishi_Kant 2020-06-28 13:01:27 969 Initial revision (published)