# OPPO R&D Interview Experience For FTE, On Campus

Oppo R&D visited our college on 6th August 2019 for hiring FTE’s.

**Online coding round** : This round comprised of 3 coding questions hosted on hackerearth platform. The questions were of easy and medium level difficulty.

**Ques 1**: Given a positive number n find total number of permutations of natural numbers from 1 to n in which indices(starting from 1) of prime numbers are also prime number. Return the ans%1000000007.

Constraints : 1<=n<=10^6.

Sample input : n=5, Sample output : 12

Possible valid permutations are : (1, 2, 3, 4, 5), (1, 2, 5, 4, 3), (1, 5, 2, 4, 3), (1, 5, 3, 4, 2), (1, 3, 2, 4, 5), (1, 3, 5, 4, 2), (4, 2, 3, 1, 5), (4, 2, 5, 1, 3), (4, 5, 2, 1, 3), (4, 5, 3, 1, 2), (4, 3, 2, 1, 5), (4, 3, 5, 1, 2).

**Solution**: Find the number of prime numbers from 1 to n, let the number be p then those p prime numbers cane be arranged at p positions in p! ways and remaining (n-p) numbers can be arranged in (n-p)! ways.So required ans is p!*(n-p)!.

**Ques 2**: Given an array A of n integers, let i denote the length of subarray of A. For every possible length of subarray i.e 1<=i<=n, count the total subarrays such that sum of all elements in it is less than or equal to k.

Input format : First line no. of test cases, Second line value of k and n, Third line contains elements of array.

Output format : for each test case print n numbers separated by space where each number is no. of subarrays of length i satisfying above condition.

Constraints : 1<=t<=20, 1<=n<=10^5, 1<=k<=10^15, 1<=A[i]<=10^9.

Input : t=1, k=4, n=3, arr= 1, 2, 3, Output : 3 1 0, Explanation : Length 1 : [{1}, {2}, {3}], Length 2: [{1, 2}], Length 3: []

**Solution** : Sliding window approach can be used to solve the question once the sum of window elements become greater than k we will count the no. of subarrays of size i in that window and update the count for them.For more detail look at the code https://ideone.com/7BvkL9.

**Ques 3**: Given an array of n positive integers calculate total sum of floor of (a[i]/a[j]) for every pair of indices i, j.

Constraints: 1<=a[i]<=10^5, 1<=n<=10^5.

Sample input : n=3, arr=[2, 4, 5].

Sample output : 8

Explanation: Ar[0]/Ar[0] + Ar[0]/Ar[1] + Ar[0]/Ar[2] = 1 + 0 + 0 = 1

Ar[1]/Ar[0] + Ar[1]/Ar[1] + Ar[1]/Ar[2] = 2 + 1 + 0 = 3

Ar[2]/Ar[0] + Ar[2]/Ar[1] + Ar[2]/Ar[2] = 2 + 1 + 1 = 4, Sum= 1+3+4=8.

**Solution** : Firstly, precalculate b[i] values which is equal to count of numbers ???*i*, it can be done in *O*(max element of arr).Consider a number i so floor of all numbers between i and 2*i(2*i not included) is gonna to contribute 1 to the sum.And all the numbers between 2*i and 3*i(3*i not included) is gonna to contribute 2 to the sum and so on. The mul var in code is taking in to account this thing.Go like a sieve and now calculating how answer change is easy since we know the count of elements between this and next multiple. For more details look at the code http://ideone.com/Xjpk7j.

After this round total of 44 candidates were shortlisted for interviews.

There were 3 round of interviews **2 technical and 1 HR**

**Round1 :** In this round interviewer mainly focussed on basic C concepts.

i. How to initialise a pointer in a function. What will be the output of following printf(++i, –i, i++, i–, i).Merge and quick sort time complexities in worst and best case and also asked me to write pseudocode for quick sort.

ii. Define the execution of program in respect of memory management, I explained him how function and its local variables gets loaded in a stack and how their deallocation happens. Then he asked explain the execution of program irrespective of memory management then I explained him the 6 phases of compiler design lexical analysis, syntax analysis etc.

iii. He asked me about dangling pointer and how does it affect the normal execution of program.

iv. Write syntax for “an array of pointer to a function returning pointer to a function returning a char pointer, I made a slight mistake in this later on the interviewer corrected me.

v. Detect cycle in a linked list. I told him slow and fast pointer approach he asked me to give a different solution other than that. I asked him for duplicates in the list he said there aren’t any duplicates in the list then i told him that date of nodes can be stored in a hashmap and once we get an entry already present in the map, there is cycle in it. Later interviewer told me that how will the method work when there are duplicates then i told him that instead of storing values of elements in map we will store address of nodes in the map.

vi. Then he asked about my project which I did at my internship, a few questions related to that.

vii. He asked me size of int, then he gave me a struct having 2 int type and one char type variable and asked me the size of that struct. He later asked me to write the code of size of operator in c which i didn’t know. Then he asked me which other companies did you apply before OPPO and why didn’t you get select.

This round was mixed one for me and i got selected for round 2.

**Round 2 :** In this round interviewer asked me to solve some coding problems and asked oops questions.First he looked at my online coding round score I wasn’t able to give an optimised solution for the third problem so he asked me to optimise that problem I gave him an optimised approach although that was not fully optimised, the interviewer got impressed with my approach.

He asked me for output for the following program.

Static int u=10;

int u=20;

int fun() {static int u=10;}

int main() {print u;}

He later framed many questions on this difference between static variable and global variable, where memory are allocated to them. He then asked me about static and dynamic binding and asked me to write an example for both.What is function overloading write an example, Among overloading and overriding which is done at runtime and which is done at compile time.Then he asked me Monty hall problem https://en.wikipedia.org/wiki/Monty_Hall_problem, I answered the problem he asked me to prove, i explained him using Bayes Theorem(conditional probability).

Print vertical order of a tree, Print a given tree like a tree structure(similar to pattern printing problem), One Bfs problem, Merge K sorted arrays and heap and its applications.

**Round 3 :** (HR) The interview started with a formal introduction.She asked me about my PPO chances in the company which I interned. Later she asked me about how was my day, One thing which you liked most and one thing which you didn’t like in our interview process.How will you bring innovations in mobile technology.

Finally **18** students (including me) got selected!!!

Tips: Besides Data structure and Algorithms go through the basics of C, Output based questions, pointers etc.

Go through entire OOPS concepts they asked OOPS in detail to every students.

**Maintain your Calm and patience**(although very difficult to maintain specially when you have a series of rejections) and believe in your skills throughout the entire placement season.

This article has been contributed by** Aishwary Kumar.**

## Recommended Posts:

- Oppo R&d Interview Experience | On-Campus for FTE
- Oppo R&D Interview Experience | On-Campus
- Oppo On-Campus Placement Drive for Product Engineer
- Walmart Lab Interview Experience | Set 7 (Off-Campus 3 Years Experience)
- MindTickle Interview Experience | Off-campus | Fresher( 0-Yr Experience)
- Walmart Lab Interview Experience | Set 8 (Off-Campus 3 Years Experience)
- Barclays Investment Bank Pune Interview Experience (On-Campus Interview)
- Valuelabs-Hyderabad Interview Experience | On-Campus Interview
- TCS Interview Experience (Off-Campus)
- 1mg Interview Experience (Off Campus)
- HP R&D Interview Experience | Set 5 (On-Campus)
- TCS Interview Experience | Set 25 (On-Campus)
- TCS Interview Experience | Set 40 (On-Campus)
- TCS Interview Experience | Set 38 (Off-Campus)
- RBS Interview Experience (On-Campus)
- TCS Interview Experience | Set 41 (On-Campus)
- IBM Interview Experience (On-Campus)
- OLA Interview Experience (Off-Campus)
- OYO Interview Experience (On Campus)
- IBM Interview Experience | On-Campus

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.