HackerRank problem solution
1. Lonely Integer problem
In this HackerRank Lonely Integer problem solution, we have Given an array of integers, where all elements but one occur twice, find the unique element.
Problem solution in Python
def lonelyinteger(a):for x in a:ax = a.count(x)if ax == 1:return x
2. Grading Student problem
def gradingStudents(grades):for x in grades:dif = ((int(x/5)*5)+5)-xif dif<3 and x>37:grades[grades.index(x)]=((int(x/5)*5)+5)else:grades[grades.index(x)] = xreturn grades
Comments
Post a Comment