Adobe Coding Questions and Answers 2023
Adobe Sample Coding Questions and Answers
Adobe Coding Questions and Answers 2023 and Sample Mock Test Paper are available on this page. We have discussed the latest sample Coding questions along with solutions to practice in different languages.
As Adobe is a dream company for many students, it is important to understand the Adobe Exam pattern, syllabus, and whole recruitment process in detail.
Adobe Coding Questions and Answers 2023 Pattern
If you are interested in Adobe Recruitment then you have come to the right place, here we have updated the pattern of Adobe Recruitment exams. Go through the page for the details of the Adobe Recruitment process.
Section Name | Total Questions | Time Limit |
---|---|---|
Quants | 20 Questions | 20 mins |
Logical Reasoning | 20 Questions | 20 mins |
Verbal English | 20 Questions | 20 mins |
Online Coding | 3 Questions | 60 mins |
Total | 63 Questions | 120 mins |
Adobe Eligibility for 2023
Here we have mentioned Adobe Eligibility Criteria in Tabular Form. Go through the table to get more details:
Adobe | Requirements |
---|---|
Qualification | B.Tech/B.E |
Eligible YOP | Student pursuing their pre final or final year |
Percentage Criteria | Minimum 70% in class X and XII |
Backlog | No Active Backlog |
- C
- C++
- Java
- Data Structure
- Total Number of Question - 3
- Total Time Allotted - 60 Mins
Prime Course Trailer
Related Banners
Get PrepInsta Prime & get Access to all 200+ courses offered by PrepInsta in One Subscription
Adobe Previous Years Coding Questions and Answers
Question 1 : Guess the word
Problem Statement :
Kochouseph Chittilappilly went to Dhruv Zplanet , a gaming space, with his friends and played a game called “Guess the Word”.
Rules of games are :
Computer displays some strings on the screen and the player should pick one string / word if this word matches with the random word that the computer picks then the player is declared as Winner.
Kochouseph Chittilappilly’s friends played the game and no one won the game. This is Kochouseph Chittilappilly’s turn to play and he decided to must win the game.
What he observed from his friend’s game is that the computer is picking up the string whose length is odd and also that should be maximum. Due to system failure computers sometimes cannot generate odd length words. In such cases you will lose the game anyways and it displays “better luck next time”. He needs your help. Check below cases for better understand
Sample input 1:
5 → number of strings
Hello Good morning Welcome you
Sample output 1:
morning
Explanation:
Hello → 5
Good → 4
Morning → 7
Welcome → 7
You → 3
First word that is picked by computer is morning
Sample input 2:
3
Go to hell
Sample output 2:
Better luck next time
Explanation:
Here no word with odd length so computer confuses and gives better luck next time
#include <bits/stdc++.h> using namespace std; int main() { int n;cin >>n; string a,result=""; while(n--) { cin >>a; if(a.length()&1) if(a.length() >result.length()) result=a; } if(result=="") cout <<"Better luck next time"; else cout << result; }
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); String arr[]=new String[n]; for(int i=0;i < n;i++) arr[i]=sc.next(); int len=0; ArrayList < String > oddLength=new ArrayList < String >(); for(int i=0;i< n;i++) { len=arr[i].length(); if(len%2==1) oddLength.add(arr[i]); } if(oddLength.size()==0) System.out.println("Better luck next time"); else { Iterator itr=oddLength.iterator(); int max=-1; String res=""; while(itr.hasNext()) { String temp=(String)itr.next(); if(temp.length() > max) { res=temp; max=temp.length(); } } System.out.println(res); } } }
n=int(input()) L=list(map(str,input().split())) result="" for a in L: if (len(a)&1): if len(a) > len(result): result=a if result=="": result="Better luck next time" print(result)
Question 2 : Share Holder (R -> Hard)
Problem Statement :
Ratan is a crazy rich person. And he is blessed with luck, so he always made the best profit possible with the shares he bought. That means he bought a share at a low price and sold it at a high price to maximize his profit. Now you are an income tax officer and you need to calculate the profit he made with the given values of stock prices each day. You have to calculate only the maximum profit Ratan earned.
Note that:
Ratan never goes into loss.
Example 1 :
Price=[1,6,2]
Ratan buys it on the first day and sells it on the second.
Example 2 :
Price=[9,8,6]
The Price always went down, Ratan never bought it.
Input Format:
First line with an integer n, denoting the number days with the value of the stack
Next n days, telling the price of the stock on that very day.
Output Format:
Maximum profit done by Ratan in a single line.
Constraints:
Number of days <=10^8
Sample Input for Custom Testing:
STDIN
7
1
9
2
11
1
9
2
Sample Output :
10
Explanation :
The maximum profit possible is when Ratan buys it in 1 rupees and sells it in 11.
#include <bits/stdc++.h> using namespace std; int solve(vector < int > v) { int n = v.size(); if (n == 0) return 0; int mx = v[0]; for (int i = 1; i < n; i++) mx = max(mx, v[i]); if (mx <= 0) return 0; int mxSum = 0; int cSum = 0; for (int i = 0; i < n; i++) { cSum += v[i]; if (cSum < 0) cSum = 0; mxSum = max(mxSum, cSum); } return mxSum; } int main() { int n; cin >> n; int price[n]; for (int i = 0; i < n; i++) cin >> price[i]; vector < int > diff; for (int i = n-2; i >= 0 ; i--) diff.push_back(price[i+1] - price[i]); int ans = solve(diff); if(ans < 0) cout << 0 << endl; else cout<< ans << endl; }
import java.util.*; public class PrepInsta { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int price[] = new int[n]; for(int i=0;i < n;i++) { price[i] = sc.nextInt(); } Vector < Integer > diff = new Vector<>(); for(int i=n-2;i >=0;i--) { diff.add(price[i+1]-price[i]); } int ans = solve(diff); if(ans < 0) { System.out.println(0); }else { System.out.println(ans); } } private static int solve(Vector < Integer > v) { int n = v.size(); if(n==0) { return 0; } int mx = v.get(0); for(int i=1;i < n;i++) { mx = Math.max(mx, v.get(i)); } if(mx <= 0) { return 0; } int mxSum=0,csum=0; for(int i=0;i < n;i++) { csum+=v.get(i); if(csum < 0) csum=0; mxSum = Math.max(csum, mxSum); } return mxSum; } }
def func(diff): n=len(diff) if n==0: return 0 mx=max(diff) if mx <= 0: return 0 mxS=0 cS=0 for i in diff: cS+=i if cS <= 0: cS=0 mxS=max(cS,mxS) return mxS n=int(input()) arr=[] diff=[] ans=[0] for i in range(n): arr.append(int(input()))c++ for i in range(n-1): diff.append(arr[i+1]-arr[i]) ans=func(diff) if ans < 0: print("0") else: print(ans)
Question 3 : Devil Groups (R->Easy)
Problem Statement :
There are some groups of devils and they splitted into people to kill them. Devils make People to them left as their group and at last the group with maximum length will be killed. Two types of devils are there namely “@” and “$”
People is represented as a string “P”
Input Format:
First line with the string for input
Output Format:
Number of groups that can be formed.
Constraints:
2<=Length of string<=10^9
Input string
PPPPPP@PPP@PP$PP
Output
7
Explanation
4 groups can be formed
PPPPPP@
PPP@
PP$
PP
Most people in the group lie in group 1 with 7 members.
#include<bits/stdc++.h> using namespace std; int main() { string str; cin >> str; size_t foundAt = str.find('@'); while (foundAt != string::npos) { str.replace(foundAt, 1, " "); foundAt = str.find('@', foundAt + 1); } size_t foundDollar = str.find('$'); while (foundDollar != string::npos) { str.replace(foundDollar, 1, " "); foundDollar = str.find('$', foundDollar + 1); } vectorarr; stringstream ss(str); string word; while (ss >> word) { arr.push_back(word); } int max_length = 0; for (const string& s : arr) { max_length = max(max_length, static_cast (s.length())); } cout << max_length + 1 << endl; return 0; }
import java.util.*; class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); String str=sc.next(); str=str.replace("@"," "); str=str.replace("$"," "); String arr[]=str.split(" "); int max=0; for(int i=0;i < arr.length;i++) max=Math.max(max,arr[i].length()); System.out.println(max+1); } }
s=input() s=s.replace("@"," ").replace("$"," ") s=s.split() ans=[] for i in s: ans.append(len(i)+1) ans[-1]-=1 print(max(ans))
Question 4 : Minimum Occurrence (R->Medium)
Problem Statement :
Given a sting , return the character that appears the minimum number of times in the string. The string will contain only ascii characters, from the ranges (“a”-”z”,”A”-”Z”,0-9), and case matters . If there is a tie in the minimum number of times a character appears in the string return the character that appears first in the string.
Input Format:
Single line with no space denoting the input string.
Output Format:
Single character denoting the least frequent character.
Constraints:
Length of string <=10^6
Sample Input:
cdadcda
Sample Output:
c
Explanation:
C and A both are with minimum frequency. So c is the answer because it comes first with less index.
#include <bits/stdc++.h> using namespace std; unordered_map < char,int > F; int main() { string s; int m=INT_MAX; cin >> s; for(auto i:s) F[i]++; for(auto i:F) m=min(m,i.second); for(auto i:s) if(F[i]==m) { cout << i; break; } }
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); String str=sc.next(); char arr[]=str.toCharArray(); int temp[]=new int[256]; for(int i=0;i < arr.length;i++) { temp[arr[i]]++; } int min=Integer.MAX_VALUE; int index=0; for(int i=255;i >= 0;i--) { if(temp[i]==0) continue; min=Math.min(min,temp[i]); } for(int i=0;i < arr.length;i++) { if(min==temp[arr[i]]) { System.out.println(arr[i]); break; } } } }
s=input() ans=[] for i in s: ans.append(s.count(i)) print(s[ans.index(min(ans))])
Question 5 : Array Subarray
Problem Statement :
You are given an array, You have to choose a contiguous subarray of length ‘k’, and find the minimum of that segment, return the maximum of those minimums.
Sample input :
1 → Length of segment x =1
5 → size of space n = 5
1 → space = [ 1,2,3,1,2]
2
3
1
2
Sample output :
3
Explanation :
The subarrays of size x = 1 are [1],[2],[3],[1], and [2],Because each subarray only contains 1 element, each value is minimal with respect to the subarray it is in. The maximum of these values is 3. Therefore, the answer is 3
#include <bits/stdc++.h> using namespace std; vector < int > arr; int prevmin=-1; int flag=0; int x,n,q; int sorting(int start,int end) { if(start+1==n) {start=0;end=end-n;} if(start==end) return arr[start]; return min(arr[start],sorting(start+1,end)); } int func(int start,int end) { if(flag==0) {flag++;return prevmin=sorting(start,end);} if(arr[start-1]==prevmin) return prevmin; return prevmin=(arr[end] <= prevmin)?prevmin:sorting(start,end); } int main() { cin >> x >> n; int ans=0; for(int i=0;i < n;i++) {cin >> q;arr.push_back(q);} for(int i=0;i < n;i++) { ans=max(ans,func(i,i+x-1)); } cout << ans; }
import java.util.*; public class DiskSpace { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int x=sc.nextInt(); int n=sc.nextInt(); int arr[]=new int[n]; for(int i=0;i < n;i++) arr[i]=sc.nextInt(); int min=Integer.MAX_VALUE; int max=Integer.MIN_VALUE; for(int i=0;i <= n-x;i++) { min=Integer.MAX_VALUE; for(int j=i;j < (i+x);j++) min=Math.min(min,arr[j]); max=Math.max(min,max); } System.out.println(max); } }
n=int(input()) arr=[] for i in range(n): arr.append(int(input())) s,a=0,0 for i in arr: s=s+i if(s < 1): a=a+(-1*s) s=0 print(a)
Question 6 : Vowel Encryption
Problem Statement :
There is an encryption game going on. You will be given a number. If a digit is prime, it will take a vowel. Otherwise it will take a consonant value.
By this process, you have to make the string the lexicographically smallest possible. For a given number, print the output as a string.;
Input Format:
An integer n denoting the number.
Output Format:
The encrypted word.
Sample Input: 123421
Sample Output: baecab
#include<bits/stdc++.h> using namespace std; map < char, char > M; map < int, bool > prime; int main() { prime[2] = true; prime[3] = true; prime[5] = true; prime[7] = true; char vow[] = { 'a', 'e', 'i', 'o', 'u' }; char con[] = { 'b', 'c', 'd', 'f', 'g', 'h' }; int jv = 0, jc = 0; string s; cin >> s; for (auto i: s) { if (prime[i - '0']) { if (M[i]) {} else { M[i] = vow[jv]; jv++; } } else if (M[i]) {} else { M[i] = con[jc]; jc++; } } for (auto i: s) cout << M[i]; }
import java.util.*; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String vowel = "aeiou"; char arr[] = new char[10]; arr[2] = 'a'; arr[3] = 'e'; arr[5] = 'i'; arr[7] = 'o'; char ch = 'b'; for (int i = 1; i < arr.length; i++) { if (vowel.indexOf(ch) != -1) { ch++; continue; } else if (arr[i] == 0) arr[i] = (char) ch++; } int temp = n; int res = 0; while (temp != 0) { res = res * 10 + temp % 10; temp = temp / 10; } int i = 1; while (res != 0) { System.out.print(arr[res % 10]); res = res / 10; } } }
s = input() res = [] x, y = 0, 0 v = "aeiou" c = "bcdfgh" p = "2357" ans = sorted(set(s)) for i in ans: if i in p: res.append(v[x]) x += 1 else: res.append(c[y]) y += 1 for i in s: print(res[ans.index(i)], end="")
Question 7: Fountains Installation
Problem Statement : Fountains are installed at every position along a one-dimensional garden of length n. Array locations[] represents the coverage limit of these fountains. The ith fountain (where 1sisn) has a coverage limit of locations[i] that can range from the position max((i – locations[i]), 1) to min((i + locations[i]), n ). In other words, the h fountains do not reach outside the boundaries of the garden. In the beginning,all the fountains are switched off. Determine the minimum number of fountains that need to be activated to cover the n length garden by water.
Example :
- n = 3
- locations[] = {0, 2, 13, then
- For position 1: locations[1] = 0, max((1 – 0),
- 1) to mini (1+0), 3) gives range = 1 to 1
- For position 2: locations[2] = 2, max((2-2),
- 1) to min( (2+2), 3) gives range = 1 to 3
- For position 3: locations[3] = 1, max( (3-1),
- 1) to min( (3+1), 3) gives range = 2 to 3
- For position 1: locations[1] = 0, max((1 – 0),
For the entire length of this garden to be covered, only the fountain at position 2 needs to be activated.
Function Description :
Complete the function fountainActivation in the editor below.
fountainActivation has the following Parameter:
- int locations[n]: the fountain locations
Returns :
- int: the minimum number of fountains that must be activated
Constraints :
- 1<_n<_ 10^5
- O<_locations[i] <_ mini (n,100) (where 1 <_1<_10^5)
► Input Format For Custom Testing
Sample Case 0 :
Sample Input For Custom Testing :
- 3 ->locations[] size n = 3
- 1 ->locations[] [1, 1, 1
- 1 ->Sample Output
Sample Output :
- 1
Explanation :
Here, locations = {1, 1, 13
- For position 1: locations[1] = 1, maxi (1 -1), 1) to min((1+1), 3) gives range = 1 to 2
- For position 2: locations[2] = 1, max( (2 -1), 1) to min( (2+1), 3) gives range = 1 to 3
- For position 3: locations[3] = 1, max((3 -1), 1) to min((3+1), 3) gyes range = 2 to 3
If the 2nd fountain is active, the range from position 7 to 3 will be covered. The total number of fountains needed is 1.
#include<bits/stdc++.h> #define ll long long using namespace std; bool compare(pair < int, int > A, pair < int, int > B) { if (A.first = B.first) return A.second < B.second; return A.first < B.first; } int solve(int location[], int n) { pair < int, int > range[n]; for (int i = 0; i < n; i++) { int id = i + 1; range[i].first = max(1, id - location[i]); range[i].second = min(n, id + location[i]); } sort(range, range + n, compare); int i = 0; int ans = 0; while (i < n) { pair < int, int > p = range[i]; ans++; while (i + 1 < n && range[i].first == range[i + 1].first) { p.second = max(p.second, range[i + 1].second); i++; } //cout<<p.second<<" "<<i<<endl; while (i < n && range[i].second <= p.second) i++; //cout<<p.second<<" "<<i<<endl; } return ans; } int main() { int n; cin >> n; int location[n]; for (int i = 0; i < n; i++) cin >> location[i]; cout << solve(location, n) << endl; return 0; }
import java.util.*; class Pair { Integer a; Integer b; Pair() {} Pair(Integer a, Integer b) { this.a = a; this.b = b; } public Integer getA() { return a; } public void setA(Integer a) { this.a = a; } public Integer getB() { return b; } public void setB(Integer b) { this.b = b; } } class SortingPair implements Comparator { @Override public int compare(Pair o1, Pair o2) { if (o1.getA() == o2.getA()) { if (o1.getB() < o2.getB()) { return 1; } else { return 0; } } if (o1.getA() < o2.getA()) { return 1; } else { return 0; } } } public class Solution { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int location[] = new int[n]; for (int i = 0; i < n; i++) { location[i] = sc.nextInt(); } System.out.println(solve(location, n)); } private static int solve(int[] location, int n) { Pair range[] = new Pair[n]; for (int i = 0; i < n; i++) { int id = i + 1; range[i] = new Pair(); range[i].setA(Math.max(1, id - location[i])); range[i].setB(Math.min(n, id + location[i])); } Arrays.sort(range, new SortingPair()); int i = 0, ans = 0; while (i < n) { Pair p = range[i]; ans++; while (i + 1 < n && range[i].getA() == range[i + 1].getA()) { p.b = Math.max(p.getB(), range[i + 1].getB()); i++; } while (i < n && range[i].getB() <= p.getB()) { i++; } } return ans; } }
Question : 8 Candies
Problem Description
Question:- Krishna loves candies a lot, so whenever he gets them, he stores them so that he can eat them later whenever he wants to.
He has recently received N boxes of candies each containing Ci candies where Ci represents the total number of candies in the ith box. Krishna wants to store them in a single box. The only constraint is that he can choose any two boxes and store their joint contents in an empty box only. Assume that there are an infinite number of empty boxes available.
At a time he can pick up any two boxes for transferring and if both the boxes contain X and Y number of candies respectively, then it takes him exactly X+Y seconds of time. As he is too eager to collect all of them he has approached you to tell him the minimum time in which all the candies can be collected.
Input Format:
- The first line of input is the number of test case T
- Each test case is comprised of two inputs
- The first input of a test case is the number of boxes N
- The second input is N integers delimited by whitespace denoting the number of candies in each box
Output Format: Print minimum time required, in seconds, for each of the test cases. Print each output on a new line.
Constraints:
- 1 < T < 10
- 1 < N< 10000
- 1 < [Candies in each box] < 100009
S. No. | Input | Output |
---|---|---|
1 | 1 4 1 2 3 4 | 19 |
2 | 1 5 1 2 3 4 5 | 34 |
Explanation for sample input-output 1:
4 boxes, each containing 1, 2, 3 and 4 candies respectively.Adding 1 + 2 in a new box takes 3 seconds.Adding 3 + 3 in a new box takes 6 seconds.Adding 4 + 6 in a new box takes 10 seconds.Hence total time taken is 19 seconds. There could be other combinations also, but overall time does not go below 19 seconds.
Explanation for sample input-output 2:
5 boxes, each containing 1, 2, 3, 4 and 5 candies respectively.Adding 1 + 2 in a new box takes 3 seconds.Adding 3 + 3 in a new box takes 6 seconds.Adding 4 + 6 in a new box takes 10 seconds.Adding 5 + 10 in a new box takes 15 seconds.Hence total time taken is 34 seconds. There could be other combinations also, but overall time does not go below 33 seconds.
#include<stdio.h> #include<string.h> int main() { int i,j; int num_box=0,k=0,sum=0,times=0,tst_case,temp=0; long c[10000],s[10000]; printf("Enter the number of test case:"); scanf("%d",&tst_case); printf("Enter the number of boxes:"); for(int l=0;l<tst_case;l++) { scanf("%d",&num_box); } printf("Enter the number of candies in each box:"); for(i=0;i<num_box;i++) { scanf("%ld",&c[i]); } for(i=0;i<num_box;i++) { for(j=i+1;j<num_box;j++) { if(c[i]>c[j]) { temp=c[i]; c[i]=c[j]; c[j]=temp; } } } sum=0; k=0; for(i=0;i<num_box;i++) { sum=sum+c[i]; s[k]=sum; k++; } times=0; printf("Minimum time requried:"); for(i=1;i<k;i++) times=times+s[i]; printf("%d\n",times); return 0; }
Output 1 4 1 2 3 4 19
#include<bits/stdc++.h> using namespace std; int main() { int i,j; int num_box=0,k=0,sum=0,times=0,tst_case,temp=0; long c[10000],s[10000]; cout<<("Enter the number of test case:"); cin>>tst_case; cout<<("Enter the number of boxes:"); for(int l=0;l<tst_case;l++) { cin>>num_box; } cout<<("Enter the number of candies in each box:"); for(i=0;i<num_box;i++) { cin>>c[i]; } for(i=0;i<num_box;i++) { for(j=i+1;j<num_box;j++) { if(c[i]>c[j]) { temp=c[i]; c[i]=c[j]; c[j]=temp; } } } sum=0; k=0; for(i=0;i<num_box;i++) { sum=sum+c[i]; s[k]=sum; k++; } times=0; cout<<("Minimum time requried:"); for(i=1;i<k;i++) times=times+s[i]; cout<<times; return 0; }
Output 1 4 1 2 3 4 19
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n, i, k = 0, sum = 0, s1 = 0, t, temp = 0, j; long c[] = new long[1000009]; long s[] = new long[100009]; t = sc.nextInt(); for (int l = 0; l < t; l++) { n = sc.nextInt(); for (i = 0; i < n; i++) c[i] = sc.nextLong(); for (i = 0; i < n; i++) { for (j = i + 1; j < n; j++) { if (c[i] > c[j]) { temp = (int) c[i]; c[i] = c[j]; c[j] = temp; } } } sum = 0; k = 0; for (i = 0; i < n; i++) { sum = (int) (sum + c[i]); s[k] = sum; k++; } s1 = 0; for (i = 1; i < k; i++) s1 = (int) (s1 + s[i]); System.out.println(s1); } } }
Output 1 4 1 2 3 4 19
T = int(input()) arr1 = [] for _ in range(T): N = int(input()) arr = list(map(int, input().split())) arr.sort() count = arr[0] for i in range(1, len(arr)): count += arr[i] arr1.append(count) print(sum(arr1))
Output 1 4 1 2 3 4 19
Question 9 : Password Hacker
Problem statement :
Elliot made a KeyLogger for his friend Romero, so that he can see the passwords of his friend. Keylogger is a software that can tell you the buttons pressed in the keyboard without the consent of the user, and hence unethical. Elliot made it to hack Romero’s passwords. The one problem is, Romero writes the passwords in lowercase characters only, and the keylogger only takes the values of the keys. Like, for a it takes 1, for b 2, and for z 26. For a given number Elliot produces all combinations of passwords in a dictionary and starts a dictionary based password attack. For a given number, print all the possible passwords in a lexicographic order.
Input Format:
One line, denoting the value given by the keylogger
Output Format:
All possible combinations of keyloggers in new lines are lexicographically ordered.
Constraints:
2<=Number of digit in input<=1000
Sample Input:
1234
Sample Output:
abcd
axd
Mcd
Explanation:
For 12, you can take 1,2 that is ab, or you can take l.
#include<bits/stdc++.h> using namespace std; string ss; vector v; void fun(int i, string s) { if (i == ss.length()) { v.push_back(s); return; } if (i > ss.length()) return; if (ss[i] == '0') return; char c = 'a' + (ss[i] - '1'); fun(i + 1, s + c); if (i != s.length() - 1 && ss[i] < '3' && ss[i + 1] < '7') { int a = (ss[i] - '1' + 1), b = (ss[i + 1] - '0'); c = ('a' + (10 * a + b - 1)); fun(i + 2, s + c); } } int main() { cin >> ss; fun(0, ""); sort(v.begin(), v.end()); for (auto i : v) cout << i << endl; return 0; }
ss = input().strip() v = [] def fun(i, s): global v, ss if i == len(ss): v.append(s) return if i > len(ss): return if ss[i] == '0': return c = chr(ord('a') + int(ss[i]) - 1) fun(i + 1, s + c) if i != len(s) - 1 and ss[i] < '3' and ss[i + 1] < '7': a = int(ss[i]) - 1 + 1 b = int(ss[i + 1]) c = chr(ord('a') + (10 * a + b - 1)) fun(i + 2, s + c) fun(0, "") v.sort() for i in v: print(i)
Question 10 : Maximum Revenue
Problem statement : Amit is a salesman who wishes to know the maximum revenue received from a given item of the N products each day . Amit has a sales record of N products for M days.Helo amit to find the highest revenue received each day.
Input :
- The first line of the input consists of two space-separated integers- day(M) and item(N) representing the days and the products in the sales record.
- The next M lines consist of N space separated integers representing the sales revenue from each product each day.
Output:
- Print m space-separated integers representing the maximum revenue received each day .
Example Input:
- 3 4
- 101 123 234 344
- 143 282 499 493
- 283 493 202 304
Output:
- 344 499 493
Explanation:
- The maximum revenue received on the first day is 344 , followed by a maximum revenue of 499 on the second day and a maximum revenue of 493 on the third day.
#include <bits/stdc++.h> using namespace std; int main(){ int m,n, i,j; cin >> m; cin >> n; int arr [m][n]; for(i = 0;i < m;i++){ for (j=0;j<n;j++){ cin >> arr[i][j]; } } for (i = 0;i < m;i++){ int max = INT_MIN; for(j=0;j<n;j++){ if(arr[i][j]>max){ max = arr[i][j]; } } cout << max << " "; } return 0; }
import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc=new Scanner(System.in); int m=sc.nextInt(); int n=sc.nextInt(); int arr[][]=new int[m][n]; int i,j; for(i=0;i<m;i++){ for (j=0;j<n;j++){ arr[i][j]=sc.nextInt(); } } for (i=0;i<m;i++){ int max = Integer.MIN_VALUE; for(j=0;j<n;j++){ if(arr[i][j]>max){ max = arr[i][j]; } } System.out.println(max); } } }
m = int(input()) n = int(input()) arr = [] for i in range(0, m): ar = [] for j in range(0, n): ar.append(int(input())) arr.append(ar) for i in arr: print(max(i), end=" ")
Overall Analytics for Adobe
Total Question
63
Total Time
120 Mins
Exam Pattern
Non-Adaptive
Difficulty
Moderate to High
FAQs on Adobe Coding Questions with Solutions
Question 1: What is the eligibility criteria for Adobe?
Eligibility criteria for Adobe is:-
- BE/B.Tech
- Minimum 70% in X and XII
- No backlogs
Question 2: How to prepare for the Adobe Coding Round?
Adobe asks three coding questions in the Online Assessment round. You can prepare them on this page.
Get over 200+ course One Subscription
Courses like AI/ML, Cloud Computing, Ethical Hacking, C, C++, Java, Python, DSA (All Languages), Competitive Coding (All Languages), TCS, Infosys, Wipro, Amazon, DBMS, SQL and others
Login/Signup to comment