The Worst Programming Interview Question I’ve Ever Seen !

An interesting topic came up recently  at work – one of my colleagues asked me – what is the worst programming interview question that you’ve faced ?

 

I’ve been fortunate enough to have not faced any interview question that I thought was BS (except my first interview, which I’ll write about shortly). However, it did remind me of someone I met during an interviewing sprint to hire interns. We’ll call him Jack.

 

Years ago, Microsoft had this streamlined process to interview prospective interns on campus that looked similar to an assembly line. The idea was simple –

  • gather 40-50 interview candidates from various reputed schools
  • gather 15-20 interviewers (mostly senior engineers) from across the company
  • Create interview teams consisting of 3 interviewers each
  • arrange for a large number of interview rooms in the HR/training building on campus
  • Assign each interview candidate to an interview team
  • Make the candidates go through three interviews , one with each interviewer
  • Make a decision on spot and notify HR

This is where I met Jack. He was a very amicable person to work with and I was pretty happy that he was in my team. After the first set of interviews , we gathered to discuss the results for the first batch of candidates. As part of assigning the final scores, we started discussing the questions we asked each of the candidates.

Jack went on to explain the question he asked the candidate:

“ Code up an algorithm to give the sum of integers from 1 to 1000 !”

The obvious solution is to run a for loop from 1 to 1000, and add up the numbers.

 

I was a little surprised that he was asking such a simplistic question to the candidates. But I thought that maybe he just wants to go easy because he’s hiring interns.

 

“So I have to give her a NO-HIRE”Jack said.  I was a bit surprised because the candidate was from a very reputed CS program in the country.

  

“Why is that Jack – was she not able to solve this problem ?” I asked.

 

Jack shrugged his head in disappointment – “No she gave me a solution all right – she just ran a loop from 1 to 1000. Not the optimized solution I was looking for.”

  

This really intrigued me . Wow, I thought, maybe there is an optimal solution to this problem that I don’t know.

 

Jack continued – Well, I was looking for an O(1) solution whereas she gave me a O(n) solution”.

 

This really intrigued me and the other interviewer on our team, and we kept staring at Jack for the solution.

 

Jack said – “It’s super simple.. there is a formula for it – Sum = [n(n+1)]/2 !!!”

 

Worst Programming Interview Question

 

WHAT ?!!!?!!! “ – I almost felt like screaming out. I mean, we’re trying to test candidates on their creative problem solving skills and here was this this guy, testing people on their memorizing ability.

 

Jack felt our unspoken resentment and went on to explain – “They should have taken a discrete math course which covers the series formulae. Or even if they haven’t they can apply approximation of areas under a rectangle using Calculus to come up with an  algorithm – they must have taken a course on numerical analysis and algorithms !”.

 

After a brief discussion and having failed to convince Jack that the question might not be very well suited for interview candidates, we went back to our respective interview booths.

 

I don’t know if Jack is still asking the same question to his candidates. It might be a great question for hiring research interns at Microsoft Research or hiring research software development engineers (yes, there is such a thing). I don’t know.

 

But here are my reasons for disliking this question.

 

1. There is one specific right solution that the interviewer was looking for.

An interview should be really about assessing if a candidate can think for herself. It about gaining insights into the candidate’s approach to solving unknown or unfamiliar problems. It’s about having a candid discussion with the candidate on various aspects of the solution, problem solving methodology and related software engineering issues.

If the interviewer is fixated on a specific solution , or even worse, asks the candidate a question that has only one solution, it leaves no room for discussion. This in turn does not give you any insight into the person’s thinking ability.

2. The right solution is in not related to work the candidate would be doing.

Most of run of the mill software engineering positions involves a lot of algorithms , some data structures (because you rarely write them from scratch) and quite a bit of domain specific knowledge. With interns, you cannot expect too much domain specific knowledge – so the next best thing is to ask them about algorithms and data structures. For example – if you ask a question that can be solved using a tree, hash table, parallel arrays or some other clever trick – the candidate has a fighting chance because he could go down one of the many solution paths. Along the way, you can have a fascinating discussion on the design alternatives and gain some insights into the person’s thinking abilities, knowledge of algorithm analysis and communication skills.

However, IMHO, being able to solve this question using calculus and numerical analysis or approximation is something the intern will not need to do unless they’re in Microsoft Research. And unless you’ve taken those calculus or discrete maths courses specifically, you’re pretty much dead in the water.

3. You might hire the wrong person !!!

What if the candidate actually solves the problem the exact way Jack wanted ? That is, she gives him the O(1) solution using the series summation formula.

You’ve just give a “HIRE” to a person based on their memorization or mathematical aptitude without testing if they can code properly or design algorithms.

They might be a good memorizer and good mathematician and good programmer all in one – but you as the interviewer don’t know that !

So, in case this person turns out to be a terrible problem solver and programmer, you’ve just put the team you hired for in a very tough spot. Training interns is very expensive . A senior engineer is usually assigned to each intern to mentor them and guide them in their project. For me, this has taken up anywhere between 1-4 hours of my time each day. The reason we invest so much in our interns is because we want to hire them back after graduation. But if you have an intern who is not upto the mark, all that effort, time and money is wasted.

              The problem is only magnified if  you’ve just hired a full time employee based on the answer to that specific question. Everyone knows how expensive it is to train new employees – at Microsoft we train folks for 3-6 months without even expecting them to be really productive during this time. It’s even more expensive and problematic for HR to show someone the door in case he’s not performing well. It also seriously handicaps the ability of the team  to execute if one of their team members  is not carrying his weight. And the list for dangers of a bad hire goes on …

 

So what type of question should I ask ?

This really depends on the type of position you’re hiring for. Most large companies like Microsoft and Google tend to focus on algorithmic and data structure questions with multiple possible solutions. We always assess how the candidate is able to formulate solutions using the various data structure and algorithmic tools available to him. Along the way, we also check how the candidate communicates his approach and solution, how he’s doing under pressure, whether he tests the finished solution etc. The following three books has some examples of great computer science problems that you can tweak (of course ) for your specific needs and interviews.

  1. Algorithm Design Manual by Steven S Skiena
  2. Algorithms in a Nutshell by George T. Heineman and Gary Pollice
  3. Programming Pearls by Jon Bentley

Good luck in your future hiring endeavors ! Please share if you liked the post ๐Ÿ™‚

  • Aleksejs Ivanovs

    Here’s the thing: if you are smart enough to work with complicated products, you will be able to deduce n(n+1)/2 if you think for extra 5 minutes. You don’t need to remember this, because it’s actually very simple and logical formula. It’s a good test for abstract thinking.
    If you want to hire people who will give you a for loop to count integers and are not smart enough to find an optimized solution, you will hire people who work “from here till lunch”.

    • Justin Halls

      If you spend an extra five minutes thinking about the optimal answer to an interview question, you will be out of the door before you can utter it – more like 5 seconds under pressure in which case a non-optimal but working solution may be the better choice. With hard deadlines a good solution delivered too late is a waste of effort. A working solution delivered on time has already stolen the prize.

    • Stephen Byrne

      That’s all very well and good, and you do have a point, but what happens when the “requirements” change (as they always do) to specify that you are not to include any number divisible by 7, except on Tuesdays and that any number ending in 3 is to be changed to end in 5…then the formula is out the window and you’re back to a loop. If the question were “can you think of a way to sum an arbitrary range of integers starting at 1 that always runs in O(1) regardless of the length of the range”, then the formula is a good answer – but it’s still not testing the ability to program.

    • Well, I’d have agreed with you 7-8 years back ๐Ÿ™‚
      There’s a segment of complicated products that requires a lot of maths( Natural Language Processing, financial engineering). But there’s also an even larger segment that does not necessarily hinge on mathematical knowledge. Personally (and as a more informal interviewing policy at most teams here at Microsoft) , we don’t like to marginalize candidates because they lack abstract mathematical aptitude.
      I’ve taught both engineering mathematics (differential equations, signal processing, discrete maths etc.) and computer science courses to students for many years – aptitude in one area does not necessarily always trickle over to the other – sometimes it does – sometimes it does not. I’d personally not penalize someone if they’re light on math but otherwise is a good programmer. And I’ve had the privilege of working with many fantastic programmers and debugging experts who’re not mathematically inclined.
      IMHO, I’d rather hire a pragmatist than an abstract thinker.

      • Aleksejs Ivanovs

        I don’t think n(n+1)/2 asks you to know calculus or signal processing etc. I remember that I’ve figured this formula out when I was **teen and was trying to make my first game. It’s not complicated at all. You have to have only good abstract thinking to deduce it. No math background (except for school level algebra) needed.
        A lot of modern programmers know how to plug in a node library after searching in SO for an hour to solve a really simple problem that would ask you to think for 5-10 minutes. I know that sometimes it’s all that business wants but lately programmers (including myself) are making their own business, and I would give a job to the guy who would be able to deduce n(n+1)/2 because I know how to use his skill.

        • Aleksejs, I agree with you in philosophy – hiring someone who just can plug and chug some code is always a bad idea. That’s why I like asking really hard algorithmic puzzles which you can solve using different data structure tools and techniques – along the way it also opens up an opportunity to have a discussion on design decisions.

          I think as a business owner , you know your requirements the best. If it requires all round creative problem solving , then yes, asking mathematics questions might be a good idea.
          The greatest fear I and a lot of interviewers have is hiring someone who cannot code and debug connected systems….

  • LamiaLove

    I will point out something even worse that you missed.
    I can solve the problem in one step, no computation required at all: return 500500
    There!
    What kind of “programmer” asks a specific question for a specific set of values?!
    You PRECOMPUTE shit if you already know all the aspects of the problem, if there is no variable input. A kickass programmer like that guy should already know that, right? RIGHT?

    He’s just an asshole who remembers that one thing from school (by the way, in my country, we learn that formula somewhere between 5th and 8th grade, and the damn thing is actually really easy to deduce) and he thinks he’s some big shot for that crap.
    However I saw something worse recently. Some programming teacher asked some children in school (highschool, I think) some really simple stuff, about computing the divisors of some number.
    Obviously, the children tried doing the decent way, but that asshole knew some COMPLETELY unintuitive formula for that. I had never encountered or even heard about that formula, but I did some research and I found out there really is some cool math theorem which comes up with this formula.
    Obviously, no child understood what he was doing and, instead, they all just understood that programming is really friggin’ complicated and obscure.

    I was completely puzzled and still am about why a teacher would do such a retarded thing. I guess it’s because he has some frustrations for some reason: either he’s a failed mathematician, or a failed programmer, or some other kind of failure.
    He’s definitely not a teacher.

    • Ocramot

      I think this comic explains quite well the problem: http://smbc-comics.com/index.php?id=3565
      When people start learning and have a deep understanding of a specific field, they start to assume that EVERYONE has the same understanding of it, and that their assumptions are easy and intuitive for anyone. They forget that they have passed several steps, throughout the years, to arrive to that counclusion. Unfortunately not all “experts” are good “teachers”, and not all of them should teach.

      • babaibhat

        LOL for the comic

      • Joel Langenfeld

        Fractions are a field of ordered pairs, which is easier to deal with than just a ring. Everyone knows that.

        • Totally ! If they don’t – they should not even be coming to junior high :LOL

          • well fractions are not that hard – the way from Q to R is quite a bit more involved – you can actually teach the rest really early if you want – there is not much required – the biggest obstacle is probably the “identification” of (a,b) and (c,d) when `a*d = c*b`

      • Totally agree ! That’s why sometimes its easy to learn from a beginner who is just one step ahead of you than an expert in the field (so called SMEs) ๐Ÿ™‚
        Great cartoon BTW ๐Ÿ™‚

    • Absolutely right ! I loved the passion you put in your reply ๐Ÿ™‚ Like yourself, I’ve been through a school system in my home country where too much emphasis was placed on a specific way of doing things – and hated every moment of it. It does not translate well at all to the industry where you have to solve problems creatively and there’s always a new challenge to solve. If a problem is already solved, just search for it online !!! In fact when you hit a problem/wall, the first thing one should check if the same problem has been solved before anyways, right ? ๐Ÿ™‚

    • please note that induction/recursion is one of the elementary building blocks of any CS education and this very formula is one of the “hello induction” examples – so it’s fair to assume that pretty much any CS graduate should have seen it.

      • LamiaLove

        You don’t know if the interviewee was a CS graduate or not. Even if it was a CS graduate, you cannot assume he is shit because he doesn’t know one specific formula which nobody uses anyway.
        We use machines to tell them to compute stuff. That is what is essential. Knowing how to tell machines to compute stuff, not deducing formulas for computing stuff. There are certain fields in math which do this, not programmers.
        Memorizing optimal formulas is not what is important. You can find that info if you really need it one day.
        What is important is coming up with a logical solution for a problem, preferably an easy to understand and debug solution.

        Anyway, the essential thing in the story is that interviewer is an asshole.

        • no I don’t that’s true – but I would indeed expect people to have seen it.

          Where did I say someone *is* “shit”?

          And “nobody uses”? … well … don’t even know what to answer aside from this being used all over math …

          If you as a programmer are ok with just being a _code monkey_ that’s fine – I would cry out in despair – it’s just not the way I *tick* – of course that might be because I have a math-degree …

          As an side note: if you do nothing in your work than pull together packages/google search-results and stackoverflow questions then in what way to you expect to have a future? Do you say this to your boss?

          • LamiaLove

            I don’t know where all you elitist programmers work, but I have never used that formula in code outside high school. Have you?
            Most people writing code write SIMPLE code. The complexity of the job NEVER comes from not using the best formula. The bottlenecks NEVER come from not using the best formula. My math degree counted for exactly nothing in my job as a programmer. My high school knowledge would have been enough for most of the programming stuff I ever did at work. The rest is stuff I learned on my own anyway, and none about math.

            Seriously, where do you elitist programmers work?! I really want to know.

  • korfuntu

    Just to set the record straight…The standard answer to the question “Why are manhole covers round?” is incorrect. While a round manhole certainly cannot fall through the hole, that property also applies if a manhole cover was shaped as an equilateral triangle. Try out THAT answer.

    • And that is why asking those old school puzzlers are strictly forbidden by HR policy nowadays in many places. I remember reading “How would you move Mt.Fuji?” before my internship interview back in 2005 – sadly they did not ask anything like that. I think that cult died down in early 2000s.

    • Fallacy of denial of the antecedent. The question “why are manhole covers round” does not imply that they couldn’t be some other shape.

      “Try out THAT answer.”

      WHAT answer? “They could have been triangular” is not an answer to the question. However, I would give extra credit for noting that a) manhole covers are round so they won’t fall through the hole b) other shapes such as triangles would also work c) however, circles are the maximal area and will allow the largest person or most gear to pass through; triangles are especially poor in this regard.

      • korfuntu

        Jim, I agree with your remarks. I neglected to mention that, when the question was asked of me, the answer of a round cover was put forward as the ONLY correct answer, which I realize now is incorrect. The other, more practical issues you mention were not on the table.

  • Mihai Prunescu

    The question is not so bad. The main point is how does the candidate react after being aware of the short solution. That the first answer will be the loop – that is rather OK.

    • Thanks Mihai. The question is not stellar but I’d not say its abominable. What makes the situation bad is the interviewer’s expectation of a specific solution and unwillingness to go into a dialogue and working with the candidate to formulate a acceptable solution.

  • it’s not about memoization at all – it’s one of the fundamentals you learn in math – indeed Gauss is said to have solved a very similar (I think it was sum up 1 to 100) while in elementary school. Things like this come up if you are interested in talking about big-O and in discrete math you should know when you are a CS graduate

    • I agree that the proof is trivial once you know which tools to use – induction, approximation of area under a curve or the neat trick you have given above. The question is does the candidate have these tools ? Even if he does have these tools and solves the problem – does it tell me anything about his coding abilities using most common CS tools/data structures ?
      Also, I wish the people we’re hiring were always comparable to Gauss, Newton and the like – but that’s probably not realistic ๐Ÿ™‚

      • Well maybe it does not tell you anything about his/her coding abilities (actually most interview questions don’t) – I still argue that induction (with it’s relations to recursion) is a necessary tool to know for a programmer/cs-graduate (this is like the “hello world” of induction – I would consider it general knowledge like pythagoras theorem or how to add fractions)

        And after all having this many candidates you can pick the *best* (whatever that is) – so isn’t a candidate with very good coding skills (hopefully the other 2 interviewers used different questions) *plus* a good mathematical background better?

        I probably would ask a questions like this just to see the reactions (where I work we cannot pick between candidates like this – we take what we get) – and to be honest I would be *disappointed* with some of the reactions shown here – there is never a problem with not knowing something (I am ignorant about 99.999% of all things (probably add another batch of 9s) and even in some areas where I do care – but a reaction that basically says: “I don’t know this and if you want me to know it then this is the wrong place for me anyway” would signal to me: “Hey I have a high opinion of myself and I don’t need to know what I don’t know and I am not willing to step down my pedestal and learn” is a bit *no go* – would not want to work with to many people like this.

        • That’s a fair point Carsten. I’d agree that someone with knowledge of programming + mathematics is definitely a better hire than someone with just knowledge of programming. We do have products where knowledge of mathematics is quite useful.
          Maybe the right way to go is to use it as a filtration question in addition to a core programming question. So in a 55 minute interview – ask someone a more context relevant question for 40 minutes and then use 15 minutes to ask this type of question if desired.
          And yes, having a large pool of candidates does help in selecting someone closer to the fit we’re looking for – though in this market, we have to be very cognizant of what the interviewee thinks of us regardless of whether he gets the job or not. We want to make sure he has a positive interviewing experience because that’ll impact downstream recruitment at the candidate’s university or his circle.
          Getting good candidates now-a-days is a big challenge.

  • The RIGHT answer: “You’ve given me a simple problem, for which there are number of possible designs. I could give you a trivial solution which may not be efficient (iterate and sum), a very efficient solution that may not be exstensible (return “500500”;), or a very efficient and extensible solution utilizing an equation that might take me a moment or two to work out. Refine your requirements, please.”

    • That’d have been a very mature response most interviewers would appreciate. Not sure about Jack because he was pretty fixated on a specific answer , unfortunately !

    • Peter

      Good answer. The problem is that companies use cookie cutter questions and look for cookie cutter solutions. That’s not how it should be done. Programming is about efficiency, and that’s what should be tested. So, either use automated coding tests, in which you can select the appropriate questions or create your own; or have an in-house testing process that can verify if the candidate is capable of efficient problem solving, not finding just the answer you intended, but one that works.

  • Henri de Feraudy

    That’s funny, but the O(1) solution came to mind instantly, and even if I had forgotten the formula, I could have rederived it in about 30 seconds.
    But I’m a mathematics teacher.

    • I know what you mean Henri. I used to be a maths tutor too – so I’m in the same boat as you. I’d have just given the formula (or even the derivation of the formula if requested) and Jack would have had to hire me – but what did he really test ? ๐Ÿ™‚

  • John mph

    template struct Sum {
    static constexpr int value = Current + Sum::value;
    };

    template struct Sum {
    static constexpr int value = 1;
    };

    int main() {
    std::cout << "Sum = ” << Sum::value << std::endl;
    }

    • “fatal error C1202: recursive type or function dependency context too complex”
      But I loved your solution of exploiting the constexpr- not only are you offloading the burden of computation on the compiler but also getting an O(1) runtime complexity. You can’t do it for very big numbers though – or you’ll get the above error. But I’d have definitely hired the candidate if she gave me this solution – not sure about Jack ๐Ÿ™‚

      • John mph

        Thanks for hiring me ;), You can pass this error with the -ftemplate-depth=1000 compiler option but yes this use of template recursion is not very recommended.

  • Chris Crochet

    This isn’t about memorization. Foreknowledge of the formula isn’t necessary.

    1) A decent programmer should instantly recognize this is an optimizable problem.
    2) A good programmer should be able to work out the formula from scratch, in a few minutes, using a few smaller spans to test and modify it.
    3) A programmer that also understands people will recognize this as a trick question, realize that the interviewer is looking specifically for the optimized solution, and therefore invest the time to do #2. Even if I was crunched for time and could only get part way through, I would submit “I believe there’s an optimized formula for this, something like (n^2)/2, but not quite; I don’t have time to finish working out the correct formula”. That, even if technically wrong, demonstrates more understanding than submitting a naive summation loop.

    • You’re right – if an interviewee presents her case like you’ve done above, it’s commendable. However, it’ll not work if the interviewer is fixated on the “right” solution and disregards everything else.

  • Joel Langenfeld

    Personally, if I’d gotten this question in an interview, my response would be at best rather flippant. It would indicate to me that the interviewer had little understanding of programming, and that the best question they could come up with was the second homework exercise from Programming 101 (the first being “Hello World”). If I were to judge the company from the interviewer, I’d strongly suspect we wouldn’t be happy together and one or both parties were wasting their time.

    • I agree with you. And I can assure you that this is not representative of 99% of interviewers at Microsoft – Jack was a one off case among dozens of interviewers I’ve worked with.

  • Ted Stockwell III

    Would Jack have disqualified me if I told I knew there was a formula but I’d have to google it? I wouldn’t know it off the top of my head anymore…

    • I think that’s a total legit answer considering we have to use google/bing so extensively in our daily work. I don’t know about Jack , but I’d have definitely not disqualified you – but then again, I wouldn’t ask that question in the first place. ๐Ÿ™‚

  • Hmm…perhaps it is an acceptable background discovery question, but not a good hiring decision making question. You learn about the candidate’s history by asking this question but you don’t learn if they are qualified to be an engineer.

    However, as a background discovery question, if they don’t answer it, it is concerning.

    I learned this algorithm first in 6th grade. Then again in algebra, then again in calculus. Then again in a Computer Science course. If a CS candidate doesn’t know this algorithm, they might be a questionable candidate. It calls into question their education. It also calls into question their experience. Have they really never encountered this algorithm?

    I would ask more background questions if they missed this. Why not just have a follow-up question:

    “The customer says your algorithm is too slow. How slow is it? Why is it slow? Can you fix it?”

    Now we are interviewing . . .

    • You raise a very valid point Jared. This would be a good way to conduct the interview indeed. Now that I think about it – if they don’t know this , what else might they not know that might impact their performance down the line. Definitely merits probing but like you said – I’d not base my hiring decision on this.

  • Optimist911

    The main reason that question is bad is that everybody already knows the answer, or should. I actually got that question in an interview way too many years ago than I care to admit, and I was surprised the interviewer even bothered to ask it. I wonder whether I should have acted as though I was trying hard to figure it out for a few seconds, suddenly getting the light bulb over my head.

    • Yes – that would be another solid reason why this is a bad question ๐Ÿ™‚ So what did you end up doing at the interview – solved it in a moment or did you give an impression of pondering? How did the interviewer react ? I’d be curious to know.

      • Optimist911

        I wouldn’t exactly call it “solving it,” but more like immediately replaying the answer. I don’t think he cared all that much, probably just using the question as an initial filter. It would likely have been either that or reversing a linked list.

  • Sorry, but anyone who doesn’t know the formula for the sum of consecutive integers is very poorly educated … I wouldn’t pass them either, and I certainly wouldn’t pass the author of this article.

  • Alex

    ha-ha

  • Gavin Burton

    Point 2 is the main one here, development is little to do with writing small 1 line algorithms.

    • Yep Gavin, the frequency of one line tricks you might need to do is way less frequent than understanding and authoring connected systems.

  • swampwiz0

    With this attitude in mind, wouldn’t the O( 0 ) answer of “50500” be even better?

  • BoMc

    I know I’m late to the discussion, but wow, this is about elementary arithmetic that we all should have learned by 6th grade. Look at the formula again: it says that the sum is equal to n times the arithmetic mean of n and 1. That’s what a mean is, right? And we all learned about means when?

    I’ve been programming since 1971, and there’s a big difference when you look at the code of those of us who have a passing acquaintance with math and those who don’t. A question like this sorts that out.

    • Welcome to the discussion ๐Ÿ™‚

      Thanks for sharing the observation regarding mean – it’s quite neat and you’re the first one to point it out.

      I have 3X less experience than you do- but from what I’ve seen, in all the products I’ve worked on , only one ( MS Search) team required advanced knowledge of maths and stats. So yes, I’d have felt quite handicapped in that specific team if I didn’t have a good maths background, but for the other 4 teams I’ve worked for in the span of my 10 year career, we did not need advanced maths knowledge. But I do understand that individual experiences may differ.

      I think the quality of Maths that’s taught in different parts of the world varies quite a bit – but yeah, I recollect learning about mean, median , mode round about grade 7. However, having been a maths tutor for school and college kids for almost 6 years, it’s my experience that the standard for maths is sliding with time.At the same time , schools are trying to introduce more computer / logic and programming related courses. Where that’ll lead us is an interesting question.

      • BoMc

        Deb, thank you for your kind words!
        When I think about topics like this I am reminded of a project many years ago, I was writing a text editor for VAX/VMS in a rather nifty language DEC had developed called TPU and at one point in the development I was faced with the task of positioning the editing window on a line wider than the terminal’s screen width so that the found result of a string search would be visible. The easy but inefficient technique would be to iterate a search in screen widths from the start of the line up to the found string position, but with a little math that can be done with one jump. So even though one doesn’t think of a text editor as being a project where math gets involved, it always helps to think in mathematical problem-solving mode.

        • Thank you for sharing that story BoMc. Perhaps it’ll motivate kids going into software engineering now-a-days at non-traditional colleges/ bootcamps to put a little more emphasis on learning the underlying mathematical concepts.