## Accolite software Interview Question for SDE1s

Country: India
Interview Type: Written Test

Comment hidden because of low score. Click to expand.
0
of 0 vote

Do not answer this question! It is a live problem in the HackerRank Week of Code 35 Contest.

Comment hidden because of low score. Click to expand.
0
of 0 vote

import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;

public class Solution {
Pattern pattern = Pattern.compile("[74][47]+");
public String macthInteger(String input1[],String input2[]){
long grater=Long.parseLong(input2[0]);
int count=0;
int pointter=0;
boolean flag=false;
for(String jack:input2){
String finaloutput=input1[count];
long val=Long.parseLong(jack);
if(pattern.matcher(jack).matches() && val>=1 && val<=1000000000 && finaloutput.length()>=1 && finaloutput.length()<=10 && Pattern.matches("[a-zA-Z]+", finaloutput) == true){
flag=true;
if(grater>=val){
grater=val;
pointter=count;
}
}
count++;
}

if(flag==true){
return input1[pointter];
}else{
return "-1";
}
}
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
Long n = in.nextLong();
Solution sol=new Solution();
String output="-1";
String s1="";
String s="";
if(n!=0 && n>=1 && n<=100000){
for(Long a0 = 0l; a0 < n; a0++){
s += in.next()+",";
Long n1 = in.nextLong();
s1+=""+n1+",";
}
if(!s.equals("") || !s1.equals("")){
String in1[]=s.split(",");
String in2[]=s1.split(",");
output=sol.macthInteger(in1,in2);
}
}
System.out.println(output);
in.close();
}
}

Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

### Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

### Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.