Please add comments in the program detailing your solution for each problem. Why you
chose the loop you used - counter-based, early-test, etc. Your comments should contain
a very brief (maximum 4 lines) description of each solution.
All programs will be tested for completeness on three different test cases.
Unless otherwise specified please do not use pre-defined libraries or functions.
Problem 1: (10 points)
Given an integer array nums, return all the pairs [nums[i], nums[i]]
Condition: i!=j and nums i - nums[j] !=0.
Notice that the solution set must not contain duplicate pairs.
Problem 2: (5 points)
Write a Java program to multiply a Matrix by a scalar.
You can hardcode/declare you matrix in the program itself. Hint: Remember a Matrix
can be considered to be a 2-dimensional matrix. To multiply a Matrix by a scalar simply
multiply each of the elements by the scalar value.
Problem 3: (5 points)
Write a program so that the numbers in the array appear in reversed order without
creating a new array. You will need to use a temporary variable to do this.
Problem 4: (5 points)
Write a Java program to find the median of an array. You should be able to handle both
single and multidimensional arrays.
Problem 5: (5 points)
Given a 2D array A, your task is to convert all the rows to columns and columns to rows and
multiplies each element by 3 .
Problem 6: (5 points)
Write a Java program to count the unique elements in an array.

Please add comments in the program detailing your solution for each problem Why you chose the loop you used counterbased earlytest etc Your comments should cont class=