Right Rotate an Array by K Elements: Three-Reverse Trick & Variations
5 min read Right Rotate an Array by K Elements: Three-Reverse, Cyclic Replacements, and Modulus Tricks Rotating an array by k positions is […] Read article
// algorithms
Coding patterns with templates and walkthroughs: two pointers, sliding window, DP, graphs — and the problems each one unlocks.
5 min read Right Rotate an Array by K Elements: Three-Reverse, Cyclic Replacements, and Modulus Tricks Rotating an array by k positions is […] Read article
3 min read A typical programming interview question is “reverse a string, in place”. if you understand pointers, the solution is simple. even Read article
3 min read problem: two trains enter a tunnel 200 miles long (yeah, its a big tunnel) travelling at 100 mph at the Read article
4 min read Problem: write the definition for this function without using any built-in functions. if pStr is null, return 0. if pStr Read article
3 min read Problem: this year on October 2, 2001, the date in MMDDYYYY format will be a palindrome (same forwards as backwards).10/02/2001when Read article
4 min read Problem: you are given a sequence of numbers from 1 to n-1 with one of the numbers repeating only once. Read article
5 min read This is a card trick without the trick. there is no sleight of hand, no tricks up my sleeve, no Read article
3 min read Part I: draw a square. divide it into four identical squares. remove the bottom left hand square. now divide the Read article
5 min read Five webloggers – joshua Allen, meg Hourihan, jason Kottke, robert Scoble, and joel Spolsky – were competing for karma points Read article
2 min read A one armed surgeon with a hand wound needs to operate on three patients. the surgeon only has two gloves. Read article
4 min read You find an old treasure map in your grandma’s attic. the map shows a cannon, a coconut tree, and a Read article
3 min read This is difficult to describe in words, so read this carefully, lest there be any confusion. You have a normal Read article
2 min read A person dies, and arrives at the gate to heaven. there are three doors. one of them leads to heaven. Read article
4 min read Every night, I dump all the change in my pocket into a big bucket. When I buy things, I never Read article
3 min read The warden meets with 23 new prisoners when they arrive. He tells them, “You may meet today and plan a Read article
What's missing, wrong, or worth adding? One line helps.
Sent — thank you. We read every one.