Пікірлер
@UtkarshChaturvedi-sb5ww
@UtkarshChaturvedi-sb5ww 23 сағат бұрын
q1: why does pow(2, ( logn/log4)) does not work?
@SarthakMahadik-y3h
@SarthakMahadik-y3h Күн бұрын
class Codechef { public static void main (String[] args) throws java.lang.Exception { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); // Number of test cases while (t-- > 0) { int n = sc.nextInt(); int[] arr = new int[n]; for (int i = 0; i < n; i++) { arr[i] = sc.nextInt(); } HashMap<Integer, Integer> map1 = new HashMap<>(); HashMap<Integer, Integer> map2 = new HashMap<>(); for (int i = 0; i < n; i++) { if (map1.containsKey(arr[i])) { map2.put(arr[i], i); } else { map1.put(arr[i], i); } } HashSet<Integer> set = new HashSet<>(); int sum = 0; // Total cost for (int i = 0; i < n; i++) { int l = map1.get(arr[i]); int r = map2.getOrDefault(arr[i], l); while (l < r) { if (map2.containsKey(arr[l]) && map2.get(arr[l]) <= r) { l++; } else if (map2.containsKey(arr[l])) { r = map2.get(arr[l]); l++; } else { break; } } sum += r - l + 1; set.add(arr[i]); } System.out.println(sum - set.size()); } } } Why is this code failing?
@NeverLoose-v5i
@NeverLoose-v5i Күн бұрын
Very Nicely Explained C
@nithiishmakkena1984
@nithiishmakkena1984 Күн бұрын
For 01 it can be done in 2 operations but according to ur code it is giving one operation
@nithiishmakkena1984
@nithiishmakkena1984 Күн бұрын
X is 2 and k is 1
@pradyumnkejriwal3007
@pradyumnkejriwal3007 Күн бұрын
​You can directly remove 01 in one operation because it has 0 inversions and 0 ≤ x and 0 is divisible by k
@Thanos_i9
@Thanos_i9 Күн бұрын
Comefrom CF blog
@UCSAmitSinghBisht
@UCSAmitSinghBisht Күн бұрын
great explanation for D bro
@HarshitKumar-dj4ev
@HarshitKumar-dj4ev Күн бұрын
Perfect explanation both mathematically as well as intuitively. Really liked the approach to explain!!
@JIGARSINGTHAKOR-yy6qp
@JIGARSINGTHAKOR-yy6qp Күн бұрын
For E ❤
@manpatel9654
@manpatel9654 Күн бұрын
Crystal Clear explanation for D🔥 Thank You sir❤
@Nerds_King
@Nerds_King Күн бұрын
sir, in problem E, you could have explained using binary numbers with a1, a2, a3, a4,... but nevertheless it was a great explanation. Really helpful.
@AvanagantiAkshathreddy
@AvanagantiAkshathreddy Күн бұрын
Explanation for problem E is very clean and intuitive, thanks!
@master_26_10
@master_26_10 Күн бұрын
Usually, whoever linkdel profile has title of pupil. He is 3 star on codechef. But despite of having 1247 on cf, I am stuck on 2 star on codechef. For me it's like solving 2 q in 10 min of div3 and then being stuck. Maier time I have solved 3rd q early also. But many times, I do fail. Sugestion pls. It's been 8 month, I am 2 star. 😢
@naman.0316
@naman.0316 Күн бұрын
Just my 2 cents on it, focus more on Number theory and Bit Manipulation questions, and you'll easily breeze through 3 stars as well 😃
@vikash-sinhaCS
@vikash-sinhaCS Күн бұрын
@master_26_10 us bro us 😢😢
@HarshitKumar-dj4ev
@HarshitKumar-dj4ev Күн бұрын
@@naman.0316 Bro, give me advice as well for 4*. I am stuck on 3* and just advancing in each contest at an average pace of +5 (since I am getting and + and - rating alternatively contest). By this pace, reaching 1800 would take months. I am stuck on Div 2-D in codechef as well as codeforces.
@cse_48_niloyroy35
@cse_48_niloyroy35 Күн бұрын
In the same situation...😢
@TLE_Eliminators
@TLE_Eliminators Күн бұрын
Please fill the Feedback form for PCD: forms.gle/eKCcKwD9pQLTr9Xb8
@allmighty2000
@allmighty2000 2 күн бұрын
4th problem is the definition of a good problem
@Abhishek-e6d2c
@Abhishek-e6d2c 2 күн бұрын
what an explanation for E!!
@raisanjeeb42
@raisanjeeb42 2 күн бұрын
Nice explanation
@manoor0858
@manoor0858 2 күн бұрын
so smart for odd one i just used like 10 testcases and it finally worked out
@rocktar6463
@rocktar6463 3 күн бұрын
best explanation
@juswanth.t133
@juswanth.t133 3 күн бұрын
For E1, I think you are mentioning we can achieve 'w' at the kth position if we have strictly less than k weights greater than 'w' in some path. I think we can only say we can achieve some weight <= w in that case. Since we are taking the minimum 'w', we end up getting the right answer. Correct me if it's wrong.
@nikhilprakash729
@nikhilprakash729 3 күн бұрын
Great Explanation......
@why_code2023
@why_code2023 3 күн бұрын
Good explanation for C! You broke things down very well. The first thing that we think for this problem is classic pick/ not pick -> dp( i , cur_difference, prev_element ). But this will TLE. And thinking top down for the correct approach is not super intuitive.
@KenOrSomething
@KenOrSomething 4 күн бұрын
TLE on test case 11 for problem B for your code
@TarunGupta-f7s
@TarunGupta-f7s 3 күн бұрын
i think you use unordered_map
@KenOrSomething
@KenOrSomething 3 күн бұрын
@@TarunGupta-f7s I don't know how you knew that but thank you! although i don't understand how using a normal map doesn't exceed TLE as inserting elements in map takes more time than unordered maps ?
@namanlalwani8079
@namanlalwani8079 4 күн бұрын
s = "nrnrs" , p = "*nn" is this true or false ? ( basically its an edge case for me )
@NeverLoose-v5i
@NeverLoose-v5i 4 күн бұрын
nice explanation.
@itzzRaghav
@itzzRaghav 4 күн бұрын
Thank you so much.
@ppl_call_me_tima
@ppl_call_me_tima 4 күн бұрын
thanks for the easy editorial
@CE073_lakshkyada
@CE073_lakshkyada 4 күн бұрын
Solution of D please
@dhruvsolanki4473
@dhruvsolanki4473 4 күн бұрын
Really good explanation helped in solving yesterday's LeetCode problem 2381. Shifting Letters 2, thank you.
@vatsaljain662
@vatsaljain662 2 күн бұрын
bro i didn't understand the technique priyanshj explained and also couldn't solve the yersterday's daily question.. can u plz explain the technique to me and how did u do it ??
@dhruvsolanki4473
@dhruvsolanki4473 2 күн бұрын
@@vatsaljain662 In yesterday's problem we just need to add +1 to i index and -1 to j+1 index if direction is 1 else do the reverse, add -1 to i index and +1 to j+1 index, skip adding to j+1 index if j+1 is out of length. And at last do the prefix sum of this array, it will give you how many shifts will each index have to do. In the beginning array will be of size word and all values will be 0.
@Abc-lr4bf
@Abc-lr4bf 4 күн бұрын
nice explanation soumojit
@KaviselvaramKathirvel
@KaviselvaramKathirvel 4 күн бұрын
I was only able to solve 2 questions from the contest !!
@Travel-s5e
@Travel-s5e 4 күн бұрын
can anybody tell me why that l to r loop not giving tle
@setyourhandle2997
@setyourhandle2997 4 күн бұрын
we are breaking out of the loop as soon as we find a number that is neither equal to a nor equal to b , for example if l was 10 r was 100 , a was 11and b was 10 we would break out of the loop as soon as we reach 12
@Travel-s5e
@Travel-s5e 4 күн бұрын
​@@setyourhandle2997 thanks bhai , one more question how can we say that after setting a and b like that then our max answer will be independent i hope you are getting like we if our l=50 and r=60 , and then if a was coming as =54 and b=58 (just consider) then our c will be coming as 50 right , but what the proof that like a^b will get maximise but we are not having any proof for b^c and c^a
@setyourhandle2997
@setyourhandle2997 4 күн бұрын
@@Travel-s5e if you work it out you will realize that if we choose a and b like this as stated in solution , then whatever our c will be , the final answer will be the same , only c has to be not equal to a and b
@Travel-s5e
@Travel-s5e 4 күн бұрын
can anybody tell me why when l is something of 00000 and r is something or 111111 then we know our a=100000.. and b=01111.... and if we are taking c as 0 then we can get a^b = max of all with all bit set and b^c = here we can get b c^a = here we can get a so answer looks like A^B + A + b any bhai or sir help please
@namanlalwani8079
@namanlalwani8079 4 күн бұрын
excited
@SubhRajShawIIEST
@SubhRajShawIIEST 4 күн бұрын
But if we consider a particular bit position and set it to 1 in all the three numbers then also for that Position after the xor the bit will be 1 hence it also maximizes. Because (1^1)^1=1.
@praveenkumar-pw8hy
@praveenkumar-pw8hy 4 күн бұрын
great explaination for c1, thanks!!
@hindolroy5561
@hindolroy5561 5 күн бұрын
Hi Raghav. Thanks for explaining the 4th one clearly, missed it in the contest as was unable to figure out the lexicographical catch.
@itzzRaghav
@itzzRaghav 4 күн бұрын
Glad to hear that.
@imPriyansh77
@imPriyansh77 5 күн бұрын
Great explanation of C. Thank you Raghav bhaiya!! very helpful
@rickparamanik580
@rickparamanik580 5 күн бұрын
i solved A,B in 30 min for the next 2hr i tried C this logic came into my mind but still could not solve it.. btw nice explanation..
@jeeaspirant8282
@jeeaspirant8282 4 күн бұрын
same 26 min for a,b but tried for 1 and half hour for c but didn't get any solid idea
@Travel-s5e
@Travel-s5e 4 күн бұрын
bhai the intutioh of third i also got but i have implememntation issue
@Mad_Monk29
@Mad_Monk29 5 күн бұрын
nice explanation
@jeevan-l5w
@jeevan-l5w 5 күн бұрын
Thank you, very helpful.
@ronakpatel2826
@ronakpatel2826 5 күн бұрын
so near to c! didnt code but approach was almost same i just wasted my time so that i could choose c optimally but it wasn't even needed hahhaa
@KanhaiyaSahu01
@KanhaiyaSahu01 5 күн бұрын
How can i buy TLE eliminator level 1 and 2 courses 12 version
@Ssanjay2004
@Ssanjay2004 5 күн бұрын
Like this Technique , plz Post more videos like this , it will be helpful for , to solve medium lvl problems on OA round with Time constraint . today date : 05-01-2025
@Abhishek-e6d2c
@Abhishek-e6d2c 5 күн бұрын
Awesome explanation for C!!
@HarshitKumar-dj4ev
@HarshitKumar-dj4ev 5 күн бұрын
good explanation.
@TLE_Eliminators
@TLE_Eliminators 5 күн бұрын
Please fill the Feedback form for PCD: forms.gle/GbcRiUTC5kqu6hjw5
@66sbjaygoti80
@66sbjaygoti80 5 күн бұрын
do anyone know when will batch 13 of tle eliminators start??