Best solutions for Microsoft interview tasks.

Alexander Molchevskyi
2 min readMay 26, 2020


Microsoft, as all other companies, doesn’t share information about the tasks they use during their interviewing process. But internet is full of lists of the tasks which collecting the people who participating in the interview. IMHO the most comprehensive and the most actual list is collected here.

So I decided it would be nice idea to collect solutions for these task in one set of articles. I’m going to write detailed explanations for each solution how it works and why I believe it is the best. I will use C++17 programming language. Each time when I finish a new article I will change corresponding string in the table of contents to a hyperlink to the article.

Small explanation about difficulty of the tasks. As you can see some tasks are market like [New Grad], [Experienced] and so on. As I understand it doesn’t show difficulty of the task, it shows a level of position which was proposed by Microsoft to a person who was interviewed.

Descriptions of the tasks from Microsoft may be slightly different than the similar solutions on Leetcode or other websites. I will describe such cases I know.

You might be interested to read a similar set of articles about the best solutions for Amazon interview tasks here and solutions for very nice set of lessons from Codility here.

Table of contents.

  1. Pattern recognition
  2. Numbers With Equal Digit Sum
  3. Min Moves to Make String Without 3 Identical Consecutive Letters
  4. Max Network Rank
  5. Min Swaps to Make Palindrome
  6. Longest Substring Without 3 Contiguous Occurrences of Letter
  7. Lexicographically Smallest String
  8. Min Deletions to Make Frequency of Each Letter Unique
  9. String Without 3 Identical Consecutive Letters
  10. Longest Semi-Alternating Substring
  11. Min Steps to Make Piles Equal Height
  12. Day of Week
  13. Max Inserts to Obtain String Without 3 Consecutive ‘a’
  14. Concatenated String Length with unique Characters
  15. Largest K such that both K and -K exist in array
  16. Min Swaps to Group Red Balls
  17. Max Length of a Concatenated String with Unique Characters
  18. Unique Integers That Sum Up To 0
  19. Min Deletions To Obtain String in Right Format
  20. Particle Velocity
  21. Partition array into N subsets with balanced sum
  22. Widest Path Without Trees [Experienced]
  23. Jump Game [Experienced]
  24. Fair Indexes
  25. Meeting Rooms II
  26. Light Bulb Switcher
  27. Plane Seat Reservation
  28. Crop Words
  29. Max Chunks to Sort Array
  30. Largest number X which occurs X times
  31. Largest M-aligned Subset
  32. Min Cost to Get String Without 2 Identical Consecutive Letters
  33. Riddle
  34. Count Visible Nodes in Binary Tree 🆕
  35. Largest Alphabetic Character 🆕
  36. [23/05/2020] Count Of Hours Variations 🆕