# Find Password 1 – Wipro Sample Coding Question Solved – codewindow.in

## Solution 2

### Solution

``````import java.io.*;
import java.util.*;

class CodeWindow {
public int findPassword(int input1, int input2, int input3, int input4, int input5) {
ArrayList<Integer> arrStable = new ArrayList<Integer>(5);
ArrayList<Integer> arrUnstable = new ArrayList<Integer>(5);

if (stable_no(input1))
else

if (stable_no(input2))
else

if (stable_no(input3))
else

if (stable_no(input4))
else

if (stable_no(input5))
else

return Collections.max(arrStable) + Collections.min(arrUnstable);
}

static void frequency(int number, int[] result) {
int temp = 0;
while (number != 0) {
temp = number % 10;
if (temp < 0) {
temp = -temp;
}
result[temp]++;
number /= 10;
}
}

static boolean stable_no(int number) {
int[] result = new int;
for (int i = 0; i < 10; ++i) {
result[i] = 0;
}
int auxiliary = 0, status = 1;
frequency(number, result);
for (int i = 0; i < 10 && status == 1; ++i) {
if (result[i] != 0) {
if (auxiliary == 0) {
auxiliary = result[i];
} else if (auxiliary != result[i]) {
status = 0;
}
}
}
if (status == 0) {
return false;
} else {
return true;
}
}
}
``````

## Coding Questions 1. Coding Question