## InMobi Interview Question for SDE-2s

Country: India

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

am I missing something in this question ?
all you need to find is , if given bar nTiles can be divided by width. if it can be and remainder is less than width , then one break is required.
Otherwise, find two factors , if two integer factors are possible then 2 break are required.

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

I have solved with code and alog : Please check gohired dot in/2014/07/rectangular-chocolate-bar-create-at dot html

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

#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <cstdio>
#include <limits>
#include <vector>
#include <cstdlib>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
while(true)
{

long long x,y,n;
cin>>x>>y>>n;
if(x*y<n)
{
cout<<"-1"<<endl;
}
else if(x*y==n)
{
cout<<"0"<<endl;
}
else if((n%x==0 && (n/x)<y) || (n%y==0 && (n/y)<x))
{
cout<<"1"<<endl;
}
else
{
bool f=false;
for(int i=1;i<=sqrt(n);i++)
{
if(n%i==0)
{
int a=i;
int b=n/i;
if((a<=x && b<=y) || (a<=y && b<=x))
{
f=true;
cout<<"2"<<endl;
break;
}
}
if(f==true)
{
break;
}
}
if(f==false)
{
cout<<"-1"<<endl;
}
}
}

return 0;
}

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

``````int getMinSplit(int height, int width, int nTiles) {
if(nTiles>height*width) return -1;
else if(nTiles==height || nTiles==width) return 1;
else if(nTiles==height*width) return 0;
else return 2;
}``````

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.