Programming task
1. Write functions
reverse (int [] table)
whose task is to reverse the order of the input elements
but you cannot create a new table as well as use external libraries and
Collections.reverse () operation
For example:
As a result of executing the code below, the array should consist of the following
elements {9,8,6,2,1}
int[] table= {1,2,6,8,9}
reverse(table)
2. What will be the result of the code below
class A {
protected void doSmth() {
System.out.println("Do smth A")
protected void doSmthElse() {
System.out.println("Do smth else A")
class B extends A {
protected void doSmth() {
System.out.println("Do smth B")
protected void doSmthElse(int i){
System.out.println("Do smth else B")
}
A ref= new B();
ref.doSmth();
ref.doSmthElse();
3. What will be the result of the code below
String str= "Example A";
str.replace("A","B");
System.out.println(str);
4. For a given list
List<String> list = List.of("John", "James", "Mark","Joanna","Henry");
using java streams
return a list that contains only names beginning with "J"
5. Given a string S, we can split S into 2 strings: S1 and S2. Return the number of ways S can
be split such that the number of unique characters between S1 and S2 are the same.
Example 1:
Input: "aaaa"
Output: 3
Explanation: we can get a - aaa, aa - aa, aaa- a
Example 2:
Input: "bac"
Output: 0
Example 3:
Input: "ababa"
Output: 2
Explanation: ab - aba, aba - ba