Errichto Algorithms
Errichto Algorithms
  • 139
  • 14 574 358
Prefix Sums - Problems, Code in C++ & Python
Prefix sums are the sums of the first K elements in an array. You can use them to quickly get the range sum and solve many other problems.
Range Sum - cses.fi/problemset/task/1646 or www.spoj.com/problems/CSUMQ/
Most Frequent - www.geeksforgeeks.org/queries-to-print-the-character-that-occurs-the-maximum-number-of-times-in-a-given-range/
Range Increase - www.hackerrank.com/challenges/crush/problem
Subarray Sum Equals K - leetcode.com/problems/subarray-sum-equals-k/
Product - leetcode.com/problems/product-of-array-except-self/
CF article - codeforces.com/blog/entry/86420
I stream on Twitch - www.twitch.tv/errichto
2nd YT channel - ua-cam.com/users/errichto2
Переглядів: 37 938

Відео

I Lost In Google Hash Code 2022
Переглядів 61 тис.2 роки тому
Going through my mistakes in GHC 2022 qualification round. [ad] Reply Code Challenge: replychallenges.com/346 Google Hash Code qualification round: codingcompetitions.withgoogle.com/hashcode/round/00000000008caae7 We should have coordinated better. I incorrectly thought that optimizing the order of doing projects is a bad idea. It's sad that strategic mistakes would be so easy to avoid. And usi...
C++ Caesar Cipher (ASCII Codes) | Algo for Beginners
Переглядів 46 тис.2 роки тому
Caesar Cipher shifts every character by a constant. It's easy to code if we use ASCII values. Train&Win high school contest: challenges.reply.com/tamtamy/challenge/2022-teen-train-win-1 School registration: replychallenges.com/TrainAndWinProgramme2022 Homework: Day 1 P03 P04 P07 P09, hit "join" on the right to register and submit solutions codeforces.com/group/yg7WhsFsAp/contests 0:00 ASCII cod...
C++ For-Loops Range | Algorithms For Beginners
Переглядів 55 тис.2 роки тому
Not sure if you should use N-1 or N-2? Let's practice how to use indices in algorithmic problems. CF Football codeforces.com/problemset/problem/96/a CSES Repetitions cses.fi/problemset/task/1069 LC Repeated DNA Seq leetcode.com/problems/repeated-dna-sequences/ 0:00 3 in a row 2:46 K in a row 4:34 code 7:49 homework I stream on Twitch: www.twitch.tv/errichto
Leetcode Biweekly #56 (2nd Place)
Переглядів 82 тис.2 роки тому
I almost won leetcode.com/contest/biweekly-contest-56 Live-stream with more detailed explanation of Q3 and Q4 ua-cam.com/video/LBB2E69Qxc8/v-deo.html 0:00 Q1. Count Square Sum Triples 0:46 Q2. Nearest Exit from Maze 4:56 Q3. Sum Game 10:09 Q4. Minimum Cost to Reach Destination 14:38 Results Subscribe for more educational videos on algorithms, coding interviews and competitive programming. - Git...
Google Code Jam 2021 R3 Screencast
Переглядів 40 тис.2 роки тому
No-commentary screencast of GCJ Round 3, sorry about the sound codingcompetitions.withgoogle.com/codejam/round/0000000000436142 Coding live streams - www.twitch.tv/errichto How to practice? - github.com/Errichto/youtube/wiki/How-to-practice? Subscribe for more educational videos on algorithms, coding interviews and competitive programming.
Kickstart 2021 Round C (1st place)
Переглядів 216 тис.2 роки тому
I won Google Kick Start 2021 Round C. Watch my screencast with commentary and post-analysis. codingcompetitions.withgoogle.com/kickstart/round/0000000000435c44 0:00 - Intro 0:35 - A 9:40 - B 16:16 - C 26:56 - D 52:06 - D, first submit 57:54 - done & solutions Coding live streams - www.twitch.tv/errichto How to practice? - github.com/Errichto/youtube/wiki/How-to-practice? Subscribe for more educ...
Google Code Jam Round 2 Screencast (full score!)
Переглядів 41 тис.3 роки тому
codingcompetitions.withgoogle.com/codejam/round/0000000000435915 Subscribe for more educational videos on algorithms, coding interviews and competitive programming. - Github repository: github.com/Errichto/youtube - Live streams on 2nd YT channel and on Twitch: ua-cam.com/users/errichto2 & www.twitch.tv/errichto - FB and Twitter: errichto & errichto - Frequently Asked Q...
Google Code Jam 2021 Round 1B (6th place)
Переглядів 187 тис.3 роки тому
My screencast and commentary of GCJ 2021 1B. Problems and leaderboard: codingcompetitions.withgoogle.com/codejam/round/0000000000435baf 0:00 A. Broken Clock 17:50 B. Subtransmutation 34:12 wrong submission 36:38 C. Digit Blocks 56:52 Summary Coding live streams - www.twitch.tv/errichto FAQ - github.com/Errichto/youtube/wiki/FAQ Subscribe for more educational videos on algorithms, coding intervi...
Sparse Table & RMQ (Range Minimum Query)
Переглядів 71 тис.3 роки тому
Tutorial on Sparse Table data structure. We use it to solve Range Minimum Query by first storing minimum for every interval with a length equal to some power of 2. problem links: www.spoj.com/problems/RMQSQ/ & cses.fi/problemset/task/1647 code github.com/Errichto/youtube/blob/master/rmq_sparse_table.cpp Coding live streams - www.twitch.tv/errichto FAQ - github.com/Errichto/youtube/wiki/FAQ Dsic...
Google Code Jam 2020 1C Practice
Переглядів 18 тис.3 роки тому
I'm solving an old GCJ round (2020 1C) in order to prepare for upcoming round 1 of GCJ 2021. Contest link: codingcompetitions.withgoogle.com/codejam/round/000000000019fef4 0:00 Intro 1:31 A. Overexcited Fan 9:58 B. Overrandomized 24:07 C. Oversized Pancakes 33:00 coding Test Set 1 (D = 3) 37:23 solving Test Set 2 46:47 coding Test Set 2 52:42 submit & summary Coding live streams - www.twitch.tv...
LCA - Lowest Common Ancestor
Переглядів 57 тис.3 роки тому
Tutorial on LCA algorithm. We use Binary Lifting to get O(N*log(N)) preprocessing and O(log(N)) to find the lowest common ancestor of two nodes in a tree. Binary Lifting video ua-cam.com/video/oib-XsjFa-M/v-deo.html SPOJ problem www.spoj.com/problems/LCASQ/ code github.com/Errichto/youtube/blob/master/lca.cpp Two homework problems: 1) Answer queries "find distance between two given nodes U and ...
Binary Lifting (Kth Ancestor of a Tree Node)
Переглядів 91 тис.3 роки тому
Tutorial on binary lifting (also called jump pointers). We find k-th ancestor of a node in O(log(N)). Problem link leetcode.com/problems/kth-ancestor-of-a-tree-node/ Final code github.com/Errichto/youtube/blob/master/leetcode/1483-kth-ancestor.cpp Coding live streams - www.twitch.tv/errichto FAQ - github.com/Errichto/youtube/wiki/FAQ Subscribe for more educational videos on algorithms, coding i...
Google Code Jam 2021 Qualification Round Solutions & Live Commentary
Переглядів 54 тис.3 роки тому
My screencast and commentary of GCJ 2021 Qualification Round. Problems and leaderboard: codingcompetitions.withgoogle.com/codejam/round/000000000043580a 0:00 A. Reversort 3:37 C. Reversort Engineering 12:40 B. Moons and umbrellas 17:55 D. Median Sort 1:26:18 E. Cheating Detection 1:55:37 Results, Summary Coding live streams - www.twitch.tv/errichto FAQ - github.com/Errichto/youtube/wiki/FAQ Sub...
Chinese Remainder Theorem, 2-minute Method
Переглядів 78 тис.3 роки тому
A simple method for Chinese Remainder Theorem (solving system of congruences), without any modular inverse. Here's my code for Advent of Code day 13 github.com/Errichto/youtube/blob/master/AOC-2020/13-search/shuttle2.cpp 0:00 Example 1 2:02 In General 2:56 LCM 4:05 Big Example 7:31 Extra Understanding Subscribe for more educational videos on algorithms, coding interviews and competitive program...
Hardest Advent of Code 2020 Problem (day 20 Jigsaw, backtracking)
Переглядів 40 тис.3 роки тому
Hardest Advent of Code 2020 Problem (day 20 Jigsaw, backtracking)
Facebook Hacker Cup 2020 Finals
Переглядів 88 тис.3 роки тому
Facebook Hacker Cup 2020 Finals
Bot Tournament | CodinGame Fall Challenge 2020
Переглядів 54 тис.3 роки тому
Bot Tournament | CodinGame Fall Challenge 2020
Yandex Cup Algo 2020 Finals - Screencast & Commentary
Переглядів 52 тис.3 роки тому
Yandex Cup Algo 2020 Finals - Screencast & Commentary
2nd Place in Google Kickstart 2020 G with keyboard-cam and commentary
Переглядів 178 тис.3 роки тому
2nd Place in Google Kickstart 2020 G with keyboard-cam and commentary
DFS With Slashes - Coding Interview Stream Highlights
Переглядів 26 тис.3 роки тому
DFS With Slashes - Coding Interview Stream Highlights
Algo Talk: Railroads from Facebook Hacker Cup
Переглядів 23 тис.3 роки тому
Algo Talk: Railroads from Facebook Hacker Cup
Facebook Hacker Cup 2020 R3 (I Got To Finals!)
Переглядів 586 тис.3 роки тому
Facebook Hacker Cup 2020 R3 (I Got To Finals!)
Algo Talk with SecondThread: Parade
Переглядів 27 тис.3 роки тому
Algo Talk with SecondThread: Parade
Facebook Hacker Cup 2020 R2 (7th place)
Переглядів 32 тис.3 роки тому
Facebook Hacker Cup 2020 R2 (7th place)
Facebook Hacker Cup 2020 R1 (full score, part 2)
Переглядів 132 тис.3 роки тому
Facebook Hacker Cup 2020 R1 (full score, part 2)
Facebook Hacker Cup 2020 R1 (full score, part 1)
Переглядів 77 тис.3 роки тому
Facebook Hacker Cup 2020 R1 (full score, part 1)
Matrix Exponentiation Coding (Part 2/2, HARD)
Переглядів 32 тис.3 роки тому
Matrix Exponentiation Coding (Part 2/2, HARD)
Facebook Hacker Cup 2020 Qual' (2nd place)
Переглядів 2,9 млн3 роки тому
Facebook Hacker Cup 2020 Qual' (2nd place)
Matrix Exponentiation Coding (Part 1/2)
Переглядів 35 тис.3 роки тому
Matrix Exponentiation Coding (Part 1/2)

КОМЕНТАРІ

  • @cahyapython
    @cahyapython 12 годин тому

    10:52 , shouldn't you check if(s[i]='0') you cant add answer to it? ex: 2019 will be 2 not 1 because 019 and 19 have the same suffix edit: lol my bad, i didnt read the problem constraint carefully

  • @adityarai8963
    @adityarai8963 18 годин тому

    These videos are gold mines, an ultimate treasure. Loved it.

  • @thirilochan_karthi_m.s
    @thirilochan_karthi_m.s 7 днів тому

    What happened to this guy is he still in Competitive programming

  • @user-dp3ri3fj1w
    @user-dp3ri3fj1w 8 днів тому

    nice

  • @Dex0z
    @Dex0z 8 днів тому

    This is him messing with computers since childhood, parents forced him through hard shooling math is essential for this type of programming

  • @IngCivil-vi9jr
    @IngCivil-vi9jr 12 днів тому

    more videoss please

  • @RahulBansal14
    @RahulBansal14 13 днів тому

    I used to waste a lot of time while solving a problem. I will stay on the problem for 1 day that was huge waste. This is a good advice think for about 20 minutes.

  • @luizeduardoreis7657
    @luizeduardoreis7657 14 днів тому

    You are an amazing teacher

  • @madelineabio9406
    @madelineabio9406 17 днів тому

    THANK YOU

  • @glad_asg
    @glad_asg 18 днів тому

    hey, ty for this video <3

  • @cya3mdirl158
    @cya3mdirl158 18 днів тому

    A wiesz jak zaprojektować duży system z użyciem DDD?

  • @pythonsamurai
    @pythonsamurai 19 днів тому

    Да говори нормально, все свои

  • @hafiz031
    @hafiz031 19 днів тому

    Can taking modulo M ensure the program would have produced correct results if we didn't take the modulo? As taking modulo with M will only produce results in [0, M-1] range. So, there might be some case, where two implementations (one is correct, and another is wrong) of the same problem might give the same results when we take the modulo and can bypass the test cases.

  • @user-pv7zx6yn9u
    @user-pv7zx6yn9u 20 днів тому

    Love this video

  • @Haphazard1945
    @Haphazard1945 22 дні тому

    I've been writing software for years and haven't interviewed in about 10. This is never used on the job so why is it tested for during interviews? Wouldn't system design make much more sense?

  • @LearnWithAnmolll
    @LearnWithAnmolll 23 дні тому

    your article is just awesome

  • @olayinkaanifowose5099
    @olayinkaanifowose5099 25 днів тому

    first time seeing this, proud of myself that i was able to come up with the alternative prefix sum algorithm within minutes. Never heard of kadane's algorithm before.

  • @pankajvermacr7
    @pankajvermacr7 Місяць тому

    Can any one help me how can i apply binary search here ? An image is represented by a binary matrix with 0 as a white pixel and 1 as a black pixel. The black pixels are connected, i.e., there is only one black region. Pixels are connected horizontally and vertically. Given the location (x, y) of one of the black pixels, return the area of the smallest (axis-aligned) rectangle that encloses all black pixels. [ [0,1,0,1,0] [0,1,0,1,0], [1,1,0,1,0], [0,1,1,1,0] ] output = 16

  • @debjit811
    @debjit811 Місяць тому

    The last problem "Count Coin change" can be solved in a much simpler way using 1D array: dp[0] = 1; for x in nums: for i from (1 to x): dp[ i ] += dp[ i - x ]; print dp[x]

  • @sahilamin219
    @sahilamin219 Місяць тому

    This video is What i have WAITED to see for YEARS . You are FIRE 🔥

  • @agustinperez8700
    @agustinperez8700 Місяць тому

    I like more the first one, for me it's the most important, just PRACTICE.

  • @LB-qr7nv
    @LB-qr7nv Місяць тому

    I thought about the fake-number-solution before. Why do we need to use -1? Just use any number not in the array, for example max(array)+1

  • @rachitsingh2013
    @rachitsingh2013 Місяць тому

    You should explain your code with a working example

  • @aziz0x00
    @aziz0x00 Місяць тому

    Thank you so so so much <3 <3

  • @Ass4Days
    @Ass4Days Місяць тому

    What language is he coding in?

  • @Vadleer
    @Vadleer Місяць тому

    I’m studying Python, thank you sir Jer salute🫡

  • @anowlwithinternet9125
    @anowlwithinternet9125 Місяць тому

    You never dissappoint!

  • @Rudra0x01
    @Rudra0x01 Місяць тому

    His chair left him to be red coder at the end

  • @wew8820
    @wew8820 Місяць тому

    this guy learned english, and computer science and how to explain things clearly and put it all on youtube for free so us dumb people can learn, what a legend

  • @sirrus3009
    @sirrus3009 Місяць тому

    And my Amazon phone screen interviewer wanted me to do this in 20 mins.

  • @MyKneeHurts
    @MyKneeHurts Місяць тому

    I have no math background. Can i still do this?

  • @kartiknagrale1479
    @kartiknagrale1479 Місяць тому

    Wow I just watched it on the 1st of April

  • @48_subhambanerjee22
    @48_subhambanerjee22 Місяць тому

    If someone has filename a.cpp... it means they are ☠️☠️💀

  • @davithov
    @davithov Місяць тому

    You're an amazing competitive programmer, but probably you should learn the c++ language a bit. For example, it was surprising to me that you didn't know about local variable's lilfetime and that it is an issue to return reference to it as it is already destroyed.

  • @aiman_yt
    @aiman_yt Місяць тому

    I'm convinced Errichto was sent by God

  • @0xCP
    @0xCP Місяць тому

    Great explanation! can you provide more problems to practice after each tutorial please? or in general what should one do after watching a tutorial like this? keep solving on the same topic or just solve problems in general? thanks a lot!

  • @CHRISTO_1001
    @CHRISTO_1001 Місяць тому

    👩🏼‍❤️‍💋‍👨🏼🇮🇳🇮🇳🥥🥥🚠🚠🥇👩🏻‍❤️‍👨🏻💝💝🙏🏻🏠🏠👨‍👩‍👧👰🏻‍♀️🏏🏠🏠🏠

  • @CHRISTO_1001
    @CHRISTO_1001 Місяць тому

    👨🏻‍🎓🥇🥇🗝️🗝️💝👰🏻‍♀️😄🥥🏠👨‍👩‍👧🕊️🥥👰🏻‍♀️💝🥇🥇🚠

  • @035asadali8
    @035asadali8 Місяць тому

    where are you bro i even forget you exist

  • @bieniumyszkowski8252
    @bieniumyszkowski8252 Місяць тому

    What if I just want to stuck for Long hours?

  • @mahindrakatta2957
    @mahindrakatta2957 2 місяці тому

    what if the question asks the maximum rectangle possible?

  • @AbjSir
    @AbjSir 2 місяці тому

    Dimension of dp is the number of variables which can completely define a state

  • @AbjSir
    @AbjSir 2 місяці тому

    dp is used to save time which gets wasted into doing repeated work Generally this happens when one state depends on more than one state

  • @supernovic99
    @supernovic99 2 місяці тому

    I like solving cs problems but this overwhelmed me

  • @johnvanschultz2297
    @johnvanschultz2297 2 місяці тому

    My man didn't even bother running the tests he went right to submit. I will never be that brave

  • @tbrjrbddo
    @tbrjrbddo 2 місяці тому

    We love Errichto..he is the best!

  • @JarppaGuru
    @JarppaGuru 2 місяці тому

    we can find nth fibonacci same fast than nth prime, but we can get is this prime faster than is this fibonacci LOL

  • @freddyhaug9379
    @freddyhaug9379 2 місяці тому

    Prefix sum really sizzled my brain two years into leetcoding. Phew!

  • @JarppaGuru
    @JarppaGuru 2 місяці тому

    5:29 yes bcoz you moved and it did something else. now it do same thing. and we not use % we use math,fom() its better

  • @sauravkumarjha2838
    @sauravkumarjha2838 2 місяці тому

    (ans-1+mod)%mod is important instead of simply ans-1 .. I couldn't figure it out myself.. for problem S-Digit Sum