Wipro Technologies Interview Question for Senior Software Development Engineers


Country: India
Interview Type: Written Test




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

vector<string> vec; //stores all perfect 89 string
void calc(string s,int num8,int num9) {
if(num8==0 && num9==0) {
vec.push_back(s);
return;
}
if(num8>num9)
return;
if(num8<0 || num9<=0)
return;
calc(s+'8',num8-1,num9);
calc(s+'9',num8,num9-1);
}
int main()
{
calc("",4,4); //Intial string, count of 8, count of 9
for(int i=0;i<vec.size();i++)
cout<<vec[i]<<endl;
}

- C++ solution January 12, 2021 | Flag Reply
Comment hidden because of low score. Click to expand.
1
of 1 vote

vector<string> vec; //stores all perfect 89 string
void calc(string s,int num8,int num9) {
    if(num8==0 && num9==0) {
        vec.push_back(s);
        return;
    }
    if(num8>num9)
        return;
    if(num8<0 || num9<=0)
        return;
    calc(s+'8',num8-1,num9);
    calc(s+'9',num8,num9-1);
}
int main()
{
    calc("",4,4); //Intial string, count of 8, count of 9
    for(int i=0;i<vec.size();i++)
        cout<<vec[i]<<endl;
}

- C++ solution January 12, 2021 | Flag Reply
Comment hidden because of low score. Click to expand.
1
of 1 vote

vector<string> vec; //stores all perfect 89 string
void calc(string s,int num8,int num9) {
if(num8==0 && num9==0) {
vec.push_back(s);
return;
}
if(num8>num9)
return;
if(num8<0 || num9<=0)
return;
calc(s+'8',num8-1,num9);
calc(s+'9',num8,num9-1);
}
int main()
{
calc("",4,4); //Intial string, count of 8, count of 9
for(int i=0;i<vec.size();i++)
cout<<vec[i]<<endl;
}

- Arjun January 12, 2021 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

IReadOnlyCollection<string> FindCombinations(int n)
        {
            if(n%2 != 0)
            {
                return new string[0];
            }

            return FindCombinations(n / 2, n / 2);
        }

        IReadOnlyCollection<string> FindCombinations(int openLeft, int closeLeft)
        {
            if (closeLeft == 0)
                return new string[] { string.Empty };

            List<string> results = new List<string>();
            if(closeLeft > openLeft)
            {
                IReadOnlyCollection<string> temp = FindCombinations(openLeft, closeLeft - 1);
                foreach (string s in temp)
                    results.Add("9" + s);
            }

            if(openLeft > 0)
            {
                IReadOnlyCollection<string> temp = FindCombinations(openLeft-1, closeLeft);
                foreach (string s in temp)
                    results.Add("8" + s);
            }

            return results;
        }

- Anonymous February 28, 2018 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 2 vote

vector<string> vec; //stores all possible strings
void calc(string s,int num8,int num9) {
if(num8==0 && num9==0) {
vec.push_back(s);
return;
}
if(num8>num9)
return;
if(num8<0 || num9<=0)
return;
calc(s+'8',num8-1,num9);
calc(s+'9',num8,num9-1);
}
int main()
{
calc("",4,4); //Intial string, number of 8, number of 9
}

- C++ solution January 12, 2021 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

vector<string> vec; //stores all perfect 89 string
void calc(string s,int num8,int num9) {
if(num8==0 && num9==0) {
vec.push_back(s);
return;
}
if(num8>num9)
return;
if(num8<0 || num9<=0)
return;
calc(s+'8',num8-1,num9);
calc(s+'9',num8,num9-1);
}
int main()
{
calc("",4,4); //Intial string, count of 8, count of 9
for(int i=0;i<vec.size();i++)
cout<<vec[i]<<endl;
}

- Miracle January 12, 2021 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Plz say language

- lokvenkatesh2222 August 02, 2021 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

public static ArrayList<String> perfect89(ArrayList<String> list, int num_8, int num_9)
{

if (num_8 == 0 && num_9 == 0)
{
return list;
}
if (list.isEmpty())
{
list.add("8");
perfect89(list, num_8 - 1, num_9);
}
else if (num_8 >= num_9)
{
ArrayList<String> templist = new ArrayList<String>();
list.forEach(v -> templist.add(v + '8'));
list.clear();
list.addAll(templist);
perfect89(list, num_8 - 1, num_9);
}
else if (num_8 == 0)
{
ArrayList<String> templist = new ArrayList<String>();
list.forEach(v -> templist.add(v + '9'));
list.clear();
list.addAll(templist);
perfect89(list, num_8, num_9 - 1);
}
else
{
ArrayList<String> templist1 = new ArrayList<String>();
list.forEach(v -> templist1.add(v + '8'));
perfect89(templist1, num_8 - 1, num_9);
ArrayList<String> templist2 = new ArrayList<String>();
list.forEach(v -> templist2.add(v + '9'));
perfect89(templist2, num_8, num_9 - 1);
list.clear();
list.addAll(templist1);
list.addAll(templist2);
}

return list;


}

- Anonymous February 26, 2018 | Flag Reply
Comment hidden because of low score. Click to expand.
-2
of 2 vote

public static ArrayList<String> perfect89(ArrayList<String> list, int num_8, int num_9)
{

if (num_8 == 0 && num_9 == 0)
{
return list;
}
if (list.isEmpty())
{
list.add("8");
perfect89(list, num_8 - 1, num_9);
}
else if (num_8 >= num_9)
{
ArrayList<String> templist = new ArrayList<String>();
list.forEach(v -> templist.add(v + '8'));
list.clear();
list.addAll(templist);
perfect89(list, num_8 - 1, num_9);
}
else if (num_8 == 0)
{
ArrayList<String> templist = new ArrayList<String>();
list.forEach(v -> templist.add(v + '9'));
list.clear();
list.addAll(templist);
perfect89(list, num_8, num_9 - 1);
}
else
{
ArrayList<String> templist1 = new ArrayList<String>();
list.forEach(v -> templist1.add(v + '8'));
perfect89(templist1, num_8 - 1, num_9);
ArrayList<String> templist2 = new ArrayList<String>();
list.forEach(v -> templist2.add(v + '9'));
perfect89(templist2, num_8, num_9 - 1);
list.clear();
list.addAll(templist1);
list.addAll(templist2);
}

return list;


}

- Kibur Girum February 26, 2018 | Flag Reply


Add a Comment
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.

Learn More

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.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More