Protected: IMIMobile telephonic

This content is password protected. To view it please enter your password below:


if input as 121213131414 i need output as 111111223344 how can u write code?

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class AscendingOrderNumbers {
    public static void main(String[] args) {

    private static void ascendingOrder(String numbers){
        List<Character> list = new ArrayList<>();
        for(char c:numbers.toCharArray())
        StringBuilder builder = new StringBuilder();
        for (char c:list){

Method Hiding In Java

Method hiding can be achived by overriding static metthod.

public class MethodHiding extends SuperMethod{
    static void foo(){
        System.out.println("I am sub class method");

    public static void main(String[] args) {;;
        SuperMethod superMethod = new SuperMethod();;
        SuperMethod superSub = new MethodHiding();;
        MethodHiding methodHiding = new MethodHiding();;
        SuperMethod superNull = null;;
        MethodHiding subNull = null;;


class SuperMethod {
    static void foo(){
        System.out.println("I am super class method");

In above code as 2 foo methods(from sub class and super class) are static methods. So we can call those method with class name as well as with references of it. Even reference are null still we didn’t get nullpointer exception.

Binary Search

Binary Search uses Divide and Conquer algorithm to search given element in a sorted array.


  1. Divide array into half
  2. Compare given value with middle element, if matches return index
  3. If the value is greater then the middle element then values is in the left array then repeat the process with the left array.
  4. If the value is less than the middle element then the value is in the right array then repeat the process with the right array.

Time complexity for binary search is O(logn).

Example :