ProgrammingTaskSet2
ProgrammingTaskSet2
1. Write functions
but you cannot create a new table as well as use external libraries and Collections.re-
verse () operation
For example:
As a result of executing the code below, the array should consist of the following ele-
ments {9,8,6,2,1}
reverse(table)
class A {
class B extends A {
}
A ref= new B();
ref.doSmth();
ref.doSmthElse();
str.replace("A","B");
System.out.println(str);
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