Adobe Interview Question for Member Technical Staffs


Country: India




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

int ReplaceNumber(int num, int toReplace, int replaceWith)
{
   char buf[32];
   itoa(num, buf, 10);
   std::replace(buf, buf + strlen(buf), '0' + toReplace, '0' + replaceWith);
   return atoi(buf);
}

int main()
{
   const int v1 = 456, v2 = 485;
   int minVal = ReplaceNumber(v1, 6, 5 ) + ReplaceNumber(v2, 6, 5 );
   int maxVal = ReplaceNumber(v1, 5, 6 ) + ReplaceNumber(v2, 5, 6 );
   return 0;
}

- tjcbs2 January 02, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

def toggleMaxMin(value, isMax):
    if isMax:
        value = value.replace('5','6')
    else:
        value = value.replace('6','5')
    return int(value)
    
var1 = input("Enter 1st number: ")
var2 = input("Enter 2nd number: ")

print('Mininum: ',(toggleMaxMin(var1, False) + toggleMaxMin(var2, False)))
print('Maximum: ', (toggleMaxMin(var1, True) + toggleMaxMin(var2, True)))

- Joy January 02, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

def toggleMaxMin(value, isMax):
    if isMax:
        value = value.replace('5','6')
    else:
        value = value.replace('6','5')
    return int(value)
    
var1 = input("Enter 1st number: ")
var2 = input("Enter 2nd number: ")

print('Mininum: ',(toggleMaxMin(var1, False) + toggleMaxMin(var2, False)))
print('Maximum: ', (toggleMaxMin(var1, True) + toggleMaxMin(var2, True)))

- Joy January 02, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

def toggleMaxMin(value, isMax):
    if isMax:
        value = value.replace('5','6')
    else:
        value = value.replace('6','5')
    return int(value)
    
var1 = input("Enter 1st number: ")
var2 = input("Enter 2nd number: ")

print('Mininum: ',(toggleMaxMin(var1, False) + toggleMaxMin(var2, False)))
print('Maximum: ', (toggleMaxMin(var1, True) + toggleMaxMin(var2, True)))

- Joy January 02, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

#include<iostream>

using namespace std;

int length(int x);
int convertmin(int x, int len);
int convertmax(int x, int len);


int main()
{
int x1=555;
int x2=666;
int max,min;
int len1=length(x1);
int len2=length(x2);
cout<<"The minimum value is :"<<convertmin(x1,len1)+convertmin(x2,len2)<<"\n";
cout<<"The maximum value is :"<<convertmax(x1,len1)+convertmax(x2,len2);


}


int length(int x)
{
int cnt=0;
while(x!=0)
{
x=x/10;
cnt++;
}
return cnt;
}

int convertmin(int x, int len)
{
int temp=x,val,testval=0;
while(temp!=0)
{
int chk=1;
for(int i=0;i<len-1;i++)
{
chk=chk*10;
}
temp=temp%chk;
val=x-temp;
x=temp;
if(val==(6*chk))
val=5*chk;
testval=testval+val;

len--;
}
return testval;
}

int convertmax(int x, int len)
{
int temp=x,val,testval=0;
while(temp!=0)
{
int chk=1;
for(int i=0;i<len-1;i++)
{
chk=chk*10;
}
temp=temp%chk;
val=x-temp;
x=temp;
if(val==(5*chk))
val=6*chk;
testval=testval+val;

len--;
}
return testval;
}

- Naveen Kumar January 03, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

#include<iostream>

using namespace std;

int length(int x);
int convertmin(int x, int len);
int convertmax(int x, int len);


int main()
{
    int x1=555;
    int x2=666;
    int max,min;
    int len1=length(x1);
    int len2=length(x2);
    cout<<"The minimum value is :"<<convertmin(x1,len1)+convertmin(x2,len2)<<"\n";
    cout<<"The maximum value is :"<<convertmax(x1,len1)+convertmax(x2,len2);
    
    
}


int length(int x)
{
    int cnt=0;
    while(x!=0)
    {
        x=x/10;
        cnt++;
    }
    return cnt;
}

int convertmin(int x, int len)
{
    int temp=x,val,testval=0;
    while(temp!=0)
    {
        int chk=1;
        for(int i=0;i<len-1;i++)
        {
            chk=chk*10;
        }
        temp=temp%chk;
        val=x-temp;
        x=temp;
        if(val==(6*chk))
            val=5*chk;
        testval=testval+val;
       
        len--;
    }
    return testval;
}

int convertmax(int x, int len)
{
    int temp=x,val,testval=0;
    while(temp!=0)
    {
        int chk=1;
        for(int i=0;i<len-1;i++)
        {
            chk=chk*10;
        }
        temp=temp%chk;
        val=x-temp;
        x=temp;
        if(val==(5*chk))
            val=6*chk;
        testval=testval+val;
       
        len--;
    }
    return testval;
}

- Naveen Kumar January 03, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

#include<iostream>

using namespace std;

int length(int x);
int convertmin(int x, int len);
int convertmax(int x, int len);


int main()
{
    int x1=555;
    int x2=666;
    int max,min;
    int len1=length(x1);
    int len2=length(x2);
    cout<<"The minimum value is :"<<convertmin(x1,len1)+convertmin(x2,len2)<<"\n";
    cout<<"The maximum value is :"<<convertmax(x1,len1)+convertmax(x2,len2);
    
    
}


int length(int x)
{
    int cnt=0;
    while(x!=0)
    {
        x=x/10;
        cnt++;
    }
    return cnt;
}

int convertmin(int x, int len)
{
    int temp=x,val,testval=0;
    while(temp!=0)
    {
        int chk=1;
        for(int i=0;i<len-1;i++)
        {
            chk=chk*10;
        }
        temp=temp%chk;
        val=x-temp;
        x=temp;
        if(val==(6*chk))
            val=5*chk;
        testval=testval+val;
       
        len--;
    }
    return testval;
}

int convertmax(int x, int len)
{
    int temp=x,val,testval=0;
    while(temp!=0)
    {
        int chk=1;
        for(int i=0;i<len-1;i++)
        {
            chk=chk*10;
        }
        temp=temp%chk;
        val=x-temp;
        x=temp;
        if(val==(5*chk))
            val=6*chk;
        testval=testval+val;
       
        len--;
    }
    return testval;
}

- naveenkumarbr111 January 03, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

#include <iostream>
#include <vector>
using namespace std;

class CMinMaxSum{
public:
int replaceNumber(int number, int compare, int replace ){
int result = 0;
int multiply = 1;
while( number ){
int rem = number%10;
if(rem == compare ){
result += (replace*multiply);
}else{
result += (rem*multiply);
}
multiply *=10;
number = number/10;
}
return result;
}

vector<int> getMinMaxSum(int number1, int number2 ){
vector<int> minMax;
int replacedNum1 = replaceNumber(number1, 5, 6 );
int replacedNum2 = replaceNumber(number2, 5, 6 );
minMax.push_back(replacedNum1+replacedNum2);

replacedNum1 = replaceNumber(number1, 6, 5 );
replacedNum2 = replaceNumber(number2, 6, 5 );
minMax.push_back(replacedNum1+replacedNum2);
return minMax;
}
};

int _tmain(int argc, _TCHAR* argv[])
{
int number1 = 0;
int number2 = 0;
cout <<"Enter First Number:";
cin >> number1;

cout <<"Enter Second Number:";
cin >> number2;

CMinMaxSum minMaxSum;
vector<int> minMax = minMaxSum.getMinMaxSum(number1, number2);
cout << "Max Sum = " << minMax[0] << endl;
cout << "Min Sum = " << minMax[1] << endl;
return 0;
}

- Anonymous January 03, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

public class MaxMin {
	public static int toggleMaxMin(int number, int oldValue, int newValue){
		String numberString = String.valueOf(number);
		String oldString = String.valueOf(oldValue);
		String newString = String.valueOf(newValue);
		String convertedString = numberString.replaceAll(oldString, newString);
		return Integer.parseInt(convertedString);
	}
	
	public static void main(String[] args){
		int v1 = 456, v2 = 485;
		int maxInt = 6;
		int minInt = 5;
		
		int minVal = toggleMaxMin(v1, maxInt, minInt ) + toggleMaxMin(v2, maxInt, minInt );
		int maxVal = toggleMaxMin(v1, minInt, maxInt ) + toggleMaxMin(v2, minInt, maxInt );
		
		System.out.println(minVal +":"+ maxVal);
	}
	
}

- Anonymous January 06, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

public class MaxMin {
	public static int toggleMaxMin(int number, int oldValue, int newValue){
		String numberString = String.valueOf(number);
		String oldString = String.valueOf(oldValue);
		String newString = String.valueOf(newValue);
		String convertedString = numberString.replaceAll(oldString, newString);
		return Integer.parseInt(convertedString);
	}
	
	public static void main(String[] args){
		int v1 = 456, v2 = 485;
		int maxInt = 6;
		int minInt = 5;
		
		int minVal = toggleMaxMin(v1, maxInt, minInt ) + toggleMaxMin(v2, maxInt, minInt );
		int maxVal = toggleMaxMin(v1, minInt, maxInt ) + toggleMaxMin(v2, minInt, maxInt );
		
		System.out.println(minVal +":"+ maxVal);
	}

}

- San January 06, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

class MinMax
{
public static void main(String[] s)
{
int a = 456, b = 485;

System.out.println(a+" and "+b);
sumMin(a,b);
sumMax(a,b);
}
static void sumMin(int a, int b)
{
System.out.println(minRmax(a,true)+minRmax(b,true));
}
static void sumMax(int a, int b)
{
System.out.println(minRmax(a,false)+minRmax(b,false));
}
static int minRmax(int a,boolean min)
{
int t = (int) (Math.log10((double)a)+1);
int d=10,div,f=0;
for(int i=0; i<t;i++)
{
div=(int)Math.pow(d,i);
int v =(a/div)%d;
if(v==6 && min)
v=5;
if(v==5 && !min)
v=6;
f=f+(v*div);

}
System.out.print("\t"+f+"\t");
return f;
}
}

- movaliya.hetal January 09, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

public class FunSum {

	public static void main(String...args)
	{
		FunSum fn=new FunSum();
		
		fn.sum("456","485");
		
	}
	public void sum(String num1,String num2)
	{
		//MIN SUM
		int i=0;
		StringBuilder newString1=new StringBuilder(num1);
		StringBuilder newString2=new StringBuilder(num2);
		
		
		String number1,number2;
		

		while(i<newString1.length())
		{
			if(newString1.charAt(i)=='5')
			{
				
				//do nothing//
			}
			else if(newString1.charAt(i)=='6')
			{
				newString1.setCharAt(i,'5');
			}
			
			i++;
		}
		
		i=0;
		
		while(i<newString2.length())
		{
			if(newString2.charAt(i)=='5')
			{
				
				//do nothing//
			}
			else if(newString2.charAt(i)=='6')
			{
				newString2.setCharAt(i,'5');
			}
			
			i++;
		}
		
		//END OF MIN FUNCTION//
		
		
		number1=newString1.toString();
		number2=newString2.toString();
		
		
		
		
		int minSum=Integer.parseInt(number1)+Integer.parseInt(number2);
		
		System.out.println(" MIN: "+minSum);
		
		//MAX FUNCTION
		
		i=0;
		
		while(i<newString1.length())
		{
			if(newString1.charAt(i)=='5')
			{
				newString1.setCharAt(i,'6');
				//do nothing//
			}
			else if(newString1.charAt(i)=='6')
			{
				//do nothing
			}
			
			i++;
		}
		
		
		i=0;
		
		while(i<newString2.length())
		{
			if(newString2.charAt(i)=='5')
			{
				newString2.setCharAt(i,'6');
				//do nothing//
			}
			else if(newString2.charAt(i)=='6')
			{
				//do nothing
			}
			
			i++;
		}
		
		
		number1=newString1.toString();
		number2=newString2.toString();
		
		
		
		int maxSum=Integer.parseInt(number1)+Integer.parseInt(number2);
		
		System.out.println(" MAX: "+maxSum);
		
		
		
				
				
	}
}

- shriniket deshmukh July 08, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

public class FunSum {

	public static void main(String...args)
	{
		FunSum fn=new FunSum();
		
		fn.sum("456","485");
		
	}
	public void sum(String num1,String num2)
	{
		//MIN SUM
		int i=0;
		StringBuilder newString1=new StringBuilder(num1);
		StringBuilder newString2=new StringBuilder(num2);
		
		
		String number1,number2;
		

		while(i<newString1.length())
		{
			if(newString1.charAt(i)=='5')
			{
				
				//do nothing//
			}
			else if(newString1.charAt(i)=='6')
			{
				newString1.setCharAt(i,'5');
			}
			
			i++;
		}
		
		i=0;
		
		while(i<newString2.length())
		{
			if(newString2.charAt(i)=='5')
			{
				
				//do nothing//
			}
			else if(newString2.charAt(i)=='6')
			{
				newString2.setCharAt(i,'5');
			}
			
			i++;
		}
		
		//END OF MIN FUNCTION//
		
		
		number1=newString1.toString();
		number2=newString2.toString();
		
		
		
		
		int minSum=Integer.parseInt(number1)+Integer.parseInt(number2);
		
		System.out.println(" MIN: "+minSum);
		
		//MAX FUNCTION
		
		i=0;
		
		while(i<newString1.length())
		{
			if(newString1.charAt(i)=='5')
			{
				newString1.setCharAt(i,'6');
				//do nothing//
			}
			else if(newString1.charAt(i)=='6')
			{
				//do nothing
			}
			
			i++;
		}
		
		
		i=0;
		
		while(i<newString2.length())
		{
			if(newString2.charAt(i)=='5')
			{
				newString2.setCharAt(i,'6');
				//do nothing//
			}
			else if(newString2.charAt(i)=='6')
			{
				//do nothing
			}
			
			i++;
		}
		
		
		number1=newString1.toString();
		number2=newString2.toString();
		
		
		
		int maxSum=Integer.parseInt(number1)+Integer.parseInt(number2);
		
		System.out.println(" MAX: "+maxSum);
		
		
		
				
				
	}
}

- shriniket deshmukh July 08, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

public class FunSum {

public static void main(String...args)
{
FunSum fn=new FunSum();

fn.sum("456","485");

}
public void sum(String num1,String num2)
{
//MIN SUM
int i=0;
StringBuilder newString1=new StringBuilder(num1);
StringBuilder newString2=new StringBuilder(num2);


String number1,number2;


while(i<newString1.length())
{
if(newString1.charAt(i)=='5')
{

//do nothing//
}
else if(newString1.charAt(i)=='6')
{
newString1.setCharAt(i,'5');
}

i++;
}

i=0;

while(i<newString2.length())
{
if(newString2.charAt(i)=='5')
{

//do nothing//
}
else if(newString2.charAt(i)=='6')
{
newString2.setCharAt(i,'5');
}

i++;
}

//END OF MIN FUNCTION//


number1=newString1.toString();
number2=newString2.toString();




int minSum=Integer.parseInt(number1)+Integer.parseInt(number2);

System.out.println(" MIN: "+minSum);

//MAX FUNCTION

i=0;

while(i<newString1.length())
{
if(newString1.charAt(i)=='5')
{
newString1.setCharAt(i,'6');
//do nothing//
}
else if(newString1.charAt(i)=='6')
{
//do nothing
}

i++;
}


i=0;

while(i<newString2.length())
{
if(newString2.charAt(i)=='5')
{
newString2.setCharAt(i,'6');
//do nothing//
}
else if(newString2.charAt(i)=='6')
{
//do nothing
}

i++;
}


number1=newString1.toString();
number2=newString2.toString();



int maxSum=Integer.parseInt(number1)+Integer.parseInt(number2);

System.out.println(" MAX: "+maxSum);





}
}

- shriniket deshmukh July 08, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

#include <iostream>
#include <string>

using namespace std;

string str_replace(string ipStr, string find_str, string replace_str)
{
int pos = 0;
while ((pos = ipStr.find(find_str, pos)) != string::npos){
ipStr.replace(pos, 1, replace_str);
pos++;
}

return ipStr;
}

int main()
{
string inputStr;
int inputNum, inputNum2;
cout << "enter 575 456 " << endl;

for (int i = 0; i < 1; i++){
cin >> inputNum;
inputStr += to_string(inputNum);
inputStr += " ";
}

cout << " Max Value = " << str_replace(inputStr, "5", "6") << endl;
cout << " Min Value = " << str_replace(inputStr, "6", "5") << endl;

return 1;
}

- Raj January 01, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

#include <iostream>
#include <string>

using namespace std;

string str_replace(string ipStr, string find_str, string replace_str)
{
	int pos = 0;
	while ((pos = ipStr.find(find_str, pos)) != string::npos){
		ipStr.replace(pos, 1, replace_str);
		pos++;
	}

	return ipStr;
}

int main()
{
	string inputStr;
	int inputNum, inputNum2;
	cout << "enter 575 456 " << endl;
	
	for (int i = 0; i < 1; i++){
		cin >> inputNum;
		inputStr += to_string(inputNum); 
		inputStr += " ";
	}
	
	cout << " Max Value = " << str_replace(inputStr, "5", "6") << endl;
	cout << " Min Value = " << str_replace(inputStr, "6", "5") << endl;
	
	return 1;
}

- Raj January 01, 2017 | 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