Advent of Code 2024 Day 20
47:01
19 сағат бұрын
Advent of Code 2024 Day 19
8:05
22 сағат бұрын
Advent of Code 2024 Day 18
30:47
Күн бұрын
Advent of Code 2024 Day 17
2:09:43
Күн бұрын
Advent of Code 2024 Day 16
35:10
Күн бұрын
Advent of Code 2024 Day 15
53:45
Күн бұрын
Advent of Code 2024 Day 14
1:02:57
Күн бұрын
Advent of Code 2024 Day 13
56:06
Күн бұрын
Advent of Code 2024 Day 12
45:39
Күн бұрын
Advent of Code 2024 Day 11
35:56
Күн бұрын
Advent of Code 2024 Day 10
24:00
Күн бұрын
Пікірлер
@oppie335
@oppie335 Күн бұрын
make daily vlogs, Larry
@cursed_nerd
@cursed_nerd Күн бұрын
Wish you were a full time vlogger
@shashankchaturvedi-zv6nc
@shashankchaturvedi-zv6nc Күн бұрын
Hey, I'm a big fan of your channel and really enjoy your tutorials . I have an idea for a video tool that I think your viewers might find interesting. Would you be open to discussing it further and potentially creating a video about it on your channel? Let me know if you're interested!
@hariharaprasad1252
@hariharaprasad1252 Күн бұрын
epic intro
@cursed_nerd
@cursed_nerd Күн бұрын
I wasted 4 hours
@Algorithmist
@Algorithmist Күн бұрын
How did you do today?
@arindampande2686
@arindampande2686 Күн бұрын
What an intro 😮
@anmeluz
@anmeluz Күн бұрын
You found the trick so quickly... I need to really dive deeper into constraints
@Algorithmist
@Algorithmist Күн бұрын
Were you able to divide this tree up?
@krityaan
@krityaan Күн бұрын
Epic intro
@elliancarlos
@elliancarlos Күн бұрын
Does this code still works? Right now I've made one similar that failed to some test cases. This was because that are individual components that can be break down from the parent down (like cutting a linked list in half) and those would be two divisible components and nor "none" or one.
@elliancarlos
@elliancarlos Күн бұрын
To fix this you can return directly into the go function check if a partial sum of a component is divisible and sum it to the answer
@slippy4006
@slippy4006 2 күн бұрын
Love the content! Found this channel recently and the explanations of your thought process in real time have really been helping me with my own competitive programming goals. Cheers!
@Algorithmist
@Algorithmist 2 күн бұрын
How did you do today?
@Algorithmist
@Algorithmist 2 күн бұрын
Were you able to get to a tree?
@Mianesy2bd
@Mianesy2bd 2 күн бұрын
nah coding inside of a plane is crazy bro!
@RyanPhung725
@RyanPhung725 2 күн бұрын
more airplane vids! XD
@Algorithmist
@Algorithmist 2 күн бұрын
How did you do today?
@Jazzimus
@Jazzimus 3 күн бұрын
the "no infinite money loops" thing and low number of nodes hinted floydwarshall to me, which imo is the easiest to implement since its just 3 for loops.
@bufdud4
@bufdud4 3 күн бұрын
Your python code still accepts, and actually faster than 70%...
@Algorithmist
@Algorithmist 3 күн бұрын
How chunky did you find this problem?
@karanchaudhary4832
@karanchaudhary4832 3 күн бұрын
little bit
@karamany9870
@karamany9870 3 күн бұрын
I finally solved the 2nd part lol. How would it compare to leetcode problems?
@ez7532
@ez7532 4 күн бұрын
Thank you, Larry
@Impromptu21
@Impromptu21 4 күн бұрын
Love your raw thinking and streams.
@rishikumar218
@rishikumar218 4 күн бұрын
Thanks a lot: here is JAVA code: class Pair <T,U>{ T first; U second; Pair(T first,U second){ this.first=first; this.second=second; } } class PqComparator implements Comparator<Pair<Long,Integer>> { public int compare(Pair<Long,Integer> p1,Pair<Long,Integer> p2) { // Compare first elements if (!p1.first.equals(p2.first)) { return Long.compare(p1.first, p2.first); } // If first elements are equal, compare second elements return Long.compare(p1.second, p2.second); } } class Solution { int MOD=(int)1e9+7; private Long pow(int x,int n){ if(n==0) return 1L; if(n==1) return (long)x; Long half=pow(x,n/2); Long ans=((half%MOD)*(half%MOD))%MOD; if((n&1)==1) ans=((ans%MOD)*(x%MOD))%MOD; return ans; } public int[] getFinalState(int[] nums, int k, int multiplier) { if(multiplier==1) return nums; // pq of nums ele and index PriorityQueue<Pair<Long,Integer>> pq=new PriorityQueue<>(new PqComparator()); ArrayList<Long> ans=new ArrayList<>(); long max_ele=0; int n=nums.length; for(int i=0;i<n;i++){ pq.add(new Pair<>((long)nums[i],i)); max_ele=Math.max(max_ele,nums[i]); ans.add((long)nums[i]); } while(k>0){ Pair<Long,Integer> top=pq.poll(); if(top.first==max_ele){ pq.add(top); break; } top.first*=multiplier; ans.set(top.second,top.first); pq.add(top); k--; } // do for cycle and leftover int cycle= k/n; int leftover= k%n; System.out.println(cycle+ " " + leftover); // leftover ArrayList<Integer> order=new ArrayList<>(); while(!pq.isEmpty()){ Pair<Long,Integer> top=pq.poll(); order.add(top.second); } int i=0; while(i<leftover){ int idx=order.get(i); ans.set(idx, ((ans.get(idx)%MOD)*multiplier)%MOD); i++; } // cycle multiplier^cycle for(i=0;i<n;i++){ ans.set(i,(((ans.get(i)%MOD)*(pow(multiplier,cycle)%MOD))%MOD)); nums[i]=(int)ans.get(i).longValue(); } return nums; } }
@Algorithmist
@Algorithmist 4 күн бұрын
How did you do today?
@cursed_nerd
@cursed_nerd 4 күн бұрын
good day, only 30 minutes
@sourabhkhandelwal689
@sourabhkhandelwal689 4 күн бұрын
pretty easy today.
@Algorithmist
@Algorithmist 4 күн бұрын
Were you able to get a good final price?
@mortysanchez361
@mortysanchez361 4 күн бұрын
larry please publish your notes/learnings. it will be very helpful for learners.
@prashant6844
@prashant6844 4 күн бұрын
I think the issue is that it is not typical FFFFTTTT and so binary search may not be applied directly? If your segments are too many, it won’t be T as each of your segment should be exactly limit except for the last segment.
@AbhinavPundhir
@AbhinavPundhir 4 күн бұрын
How many years of practice did it take you to be this good at problem solving??
@rijumondal6876
@rijumondal6876 5 күн бұрын
I am not even worthy to see this channel !
@Algorithmist
@Algorithmist 4 күн бұрын
put in the work!
@nakulgoyal2879
@nakulgoyal2879 5 күн бұрын
Did you repeat yourself?
@cursed_nerd
@cursed_nerd 5 күн бұрын
AOC is getting serious
@Algorithmist
@Algorithmist 5 күн бұрын
How did you do today?
@yashwantmoharil5892
@yashwantmoharil5892 5 күн бұрын
Did you repeat yourself?
@thomasc7526
@thomasc7526 5 күн бұрын
Did you repeat yourself?
@Algorithmist
@Algorithmist 5 күн бұрын
Did you repeat yourself?
@khoilin0
@khoilin0 5 күн бұрын
Would love to learn more about the idea of thinking about sliding windows as "contribution of ith index", do you have another clip of you going over this?
@tylermmalone
@tylermmalone 5 күн бұрын
You a Marine Larry? Love your solutions and explanations
@Algorithmist
@Algorithmist 4 күн бұрын
no! I ran the Marine Corps Marathon though!
@tylermmalone
@tylermmalone 4 күн бұрын
@ oh alright, hell yeah man
@manoor0858
@manoor0858 6 күн бұрын
hii can u make a video on tips for excelling in contests, and how should beginners start giving contests and ur thought process when u see a question with some examples
@Algorithmist
@Algorithmist 4 күн бұрын
a lot of it is practice, practice - when you're a beginner, everything you do helps, so just do anything!
@manoor0858
@manoor0858 4 күн бұрын
@@Algorithmist 👍😁
@dhanvishyam8386
@dhanvishyam8386 6 күн бұрын
heyy i couldn't understand what type of problem it was. I was confused when someone commented that this was a graph problem. How did you identify that this was a graph problem
@ManishKumar-kw7qe
@ManishKumar-kw7qe 5 күн бұрын
hints:1.look at the language of the questions--> it is very similar to a graph question " that you can convert from startCurrencyi to targetCurrencyi at a rate of rates1[i]" it is similar to you can move to node v from node u at a cost of c. 2.-->at the last you want the maxAmount of a src node (initialCurrency) this pattern is more similar to shortest distance questions,although it is not a one out of them because here we have to maximise something
@SKcoder-n7h
@SKcoder-n7h 6 күн бұрын
I just put 60 sums ,56 from easy and 4 from medium, it is taking atleast 10 minutes for a sum, will reach 200 sums??
@Krishnakantydv
@Krishnakantydv 6 күн бұрын
i tried this N2 solutoin, 530 test case passes, it fails for input; [0,0,0,0,2,2,0,1,2,1,2], expected is 19, but my soluton returns 18. I cant even see the 19th split manually. Here is the code: class Solution { public: int beautifulSplits(vector<int>& nums) { int n = nums.size(), count = 0; string total = ""; for (int i = 0; i < n; i++) { total += to_string(nums[i]); } for (int i = 0; i < n - 2; i++) { string str1 = total.substr(0, i + 1); // Check for match in the first intersection if (i <= (n - 3) / 2) { if (str1 == total.substr(i + 1, i + 1)) { int k = n - 2 * (i + 1); if (k > 0) { count += k; } continue; // No need to check second joint for this `i` } } // Check for match in the second joint for (int size = 1; size <= (n - i - 1) / 2; size++) { string str2 = total.substr(i + 1, size); if (total.substr(i + 1 + size, size) == str2) { count++; } } } return count; } }; I would appreciate a little help in spotting the problem.
@Algorithmist
@Algorithmist 5 күн бұрын
for small inputs, just run an N^3 solution and then compare your solution to it - so basically you are writing a verifier to help yourself debug
@Algorithmist
@Algorithmist 6 күн бұрын
How did you do today?
@SKcoder-n7h
@SKcoder-n7h 4 күн бұрын
@@Algorithmist Today I done 2 sums
@dank7044
@dank7044 6 күн бұрын
I did it in C++, and it overflowed in the simulation part lol. Even after using long long.
@Algorithmist
@Algorithmist 6 күн бұрын
Are you able to get to your final state?
@akshatgupta1092
@akshatgupta1092 6 күн бұрын
looked bfs but was easy lol
@nhienle5137
@nhienle5137 7 күн бұрын
Lary is rock yesterday, I'm 1/4 at 2k2, rip my rank 😂
@santali-tr3rj
@santali-tr3rj 7 күн бұрын
class Solution { public: int makeStringGood(string s) { //delete everything int fre[26]={0}; for(int i =0 ;i<s.size();i++) fre[int(s[i]) - 97]++; //hint is complexity = O(26 * N) // 2nd hint , operate on fre[26] to make 0 or c // agar if u do third operation then previous has to be deleted only - 3rd hint //try 1 to s.size() as the value of c //hint from LC - delete somebody by +1 and promte it can be done at arriving on the elements by +1 //min(s.size() , max(fre[i])) int ans = INT_MAX; for(int c = 0;c<=s.size();c++) { int dp[26][2] ={0}; dp[0][0] = fre[0]; if(c>=fre[0]) dp[0][1] = c- fre[0] ; else dp[0][1] = fre[0] - c; for(int j = 1;j<26;j++) { if( c >= fre[j] ) dp[j][1] = min( dp[j-1][1] + max(0 ,c - fre[j] - max( 0 , fre[j-1] - c) ) , dp[j-1][0] + max(0 , c- fre[j] - fre[j-1]) ); else dp[j][1] = min(dp[j-1][1] + fre[j] - c , dp[j-1][0] + fre[j] - c ); dp[j][0] = min( dp[j-1][0] + fre[j] , dp[j-1][1] +fre[j] ); } ans = min({ans , dp[25][0] , dp[25][1]}); } return ans; } };
@santali-tr3rj
@santali-tr3rj 7 күн бұрын
i tried greedy but failed, try all divisors of 1 to s.size() and then 26*26 , taking out which character is better to keep first decide
@bhanupratapsinghrathore6463
@bhanupratapsinghrathore6463 7 күн бұрын
Thanks for the code. Your bottom up code beats 100%.
@ozzyvines6891
@ozzyvines6891 7 күн бұрын
genius
@rijumondal6876
@rijumondal6876 7 күн бұрын
If Batman has a face