How can i optimize my code for better time complexity?

Правка en1, от dorasainath955, 2024-10-08 19:57:25

Submission this is the problem I'm trying to solve, my approach is to create a map that consists of each element and their frequency count, then for intial MEX i try to find elements less than MEX and such that x%(mp[i]-MEX)==0 and mp[i]>1. i try to convert that repeating element into MEX, if i couldn't I'll break out and print the MEX as answer, else I'll repeat the process until i reach size of array n. Where am i going wrong?

Теги brute force, number theory, greedy, math

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский dorasainath955 2024-10-08 19:57:25 549 Initial revision (published)