The Wayback Machine - https://web.archive.org/web/20240204104303/https://www.geeksforgeeks.org/puzzle-40-find-missing-row-in-excel/
Open In App
Related Articles

Puzzle 40 | (Find missing Row in Excel)

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Report issue
Report

We are given an excel sheet which contains integers from 1 to 50, including both. However, the numbers are in a jumbled form and there is 1 integer missing. You have to write a code to identify the missing integer. Only the logic is required.

 
 
 


Solution:

We know that the sum of all the numbers from 1 to n is (n*(n+1)/2)
Therefore, sum of all the numbers from 1 to 50 is

50*(50+1)/2  (Here, n = 50) 
  = 50*(51)/2 
  = 25*51
  = 1275.

Therefore, all we need to do is to sum all the integers present in the file and subtract the sum from 1275. The difference between 1275 and this sum would give us the missing integer.

See this for code.

This puzzle is contributed by Feroz Baig.

Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Looking for a place to share your ideas, learn, and connect? Our Community portal is just the spot! Come join us and see what all the buzz is about!


Last Updated : 19 Jan, 2023
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads