In order to get better at coding, the key is to Solve Simple Programming Problems. Although you can choose your favourite programming language for coding, C and C++ are still the most popular languages among students.
The following list provides some basic programming problems that you can try to practice in any language.
Simple Programming Problems
The following problem consists of finding the sum of randomly chosen three elements of an array of integers of length m. For instance, let us suppose we have an array like this: [5, 1, 9, 8, 23, 88, 19, 56]. Now that we select three random index values 3, 2, 5 in the range [0, 7]. Therefore, the output will be 105.
Sometimes, the mean of certain values is more important than the values themselves. The following problem illustrates it. Suppose we have an array containing negative, positive, and zero values. Now that, first find the mean of negative and positive values respectively and then compare the absolute value of both means to find which one is greater.
As an input you are given the time in seconds. Your task is o find total number of years, months, days, hours, minutes, and seconds.
Take two 3X3 matrices and arrange their elements in order collectively row-wise. For instance, suppose you have the following two matrices.
For a 3X3 matrix perform the following operations – find sum of each row, each column, and each diagonal and display it.
For the purpose of making the sum of elements of the first row maximum in a 3X3 matrix, you can reverse its rows or columns any number of times. Find out what the elements will be and the resulting sum. For instance, look at the following example. Here the maximum sum of the first row turns out to be 20.
Take the case of an array of n (1<=n<=10) elements, find the maximum sum of any of its possible 2-element subsets. For example, suppose we have the following array: [1, 2, 18, 5, 3]. In that case, its all 2-element subsets are [[1, 2], [1, 18], [1, 5], [1, 3], [2, 18], [2, 5], [2, 3], [18, 5], [18, 3], [5, 3]]. Evidently, the maximum sum is 23 of the subset [18, 5].