Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

How do you find the missing number in a given integer array of 1 to 100?

def getMissingNo(A):
    n = len(A)
    total = (n + 1)*(n + 2)/2
    sum_of_A = sum(A)
    return total - sum_of_A
 
A = [1, 2, 4, 5, 6]
miss = getMissingNo(A)
print(miss)

## Good luck with your Interview!!!! :)
Comment

PREVIOUS NEXT
Code Example
Python :: remove first 2 rows in pandas 
Python :: python cmath constants 
Python :: django model current timestamp 
Python :: django making a custom 403 page 
Python :: slack send message python 
Python :: discord.py get guild member list 
Python :: python read folder 
Python :: while loop user input python 
Python :: label encoding 
Python :: blank=True 
Python :: create a df in pandas 
Python :: pthon - progressbar 
Python :: how to change role permissions in discord.py 
Python :: create a role with discord.py 
Python :: from imblearn.over_sampling import smote error 
Python :: Creating a list with list comprehensions 
Python :: matplotlib plot 2d point 
Python :: tkinter new line in text 
Python :: python catch multiple exceptions 
Python :: login_required 
Python :: pytest run only failed test 
Python :: python folder exists 
Python :: plot histogram in seaborn 
Python :: pandas iloc select certain columns 
Python :: remove special characters from string python 
Python :: python get address of object 
Python :: decision tree classifier 
Python :: first 5 letters of a string python 
Python :: python sqlite insert 
Python :: pandas dataframe from tsv 
ADD CONTENT
Topic
Content
Source link
Name
2+9 =