I am collecting here varous coding problems and tasks from different sources. Most of them are not fixed to particular technology and considered as entry level for developers who want to start their career in tech companies.
-
On election day, a voting machine writes data in the form
(voter_id, candidate_id)
to a text file. Write a program that reads this file as a stream and returns the top3
candidates at any given time. If you find a voter voting more than once, report this as fraud. -
Given a sorted list of integers, square the elements and give the output in sorted order. For example, given
[-9, -2, 0, 2, 3]
, return[0, 4, 4, 9, 81]
. -
Given an array of numbers and a number k, determine if there are three entries in the array which add up to the specified number k. For example, given
[20, 303, 3, 4, 25]
andk = 49
, returntrue
as20 + 4 + 25 = 49
.