is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.
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.
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.
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.
what we can do in this question is initialize an array like this:-
- reyanshjain91 January 27, 2014arr={1,0,0,0,0,0,0,0,0,0}
this array represent the occurrence of a digit as
arr[0] for 0 occurrence, arr[1] for 1 occurrence....
Now,
if(n!=0)
{
for(int i=1;i<n; i++) //this will increase the series from 1 to n
{
while(i!=0)
{
int rem= i%10;
arr[rem]= arr[rem]+1;
//this increase the value of rem digit by 1 in arr array
//for ex:-
//if the value of i is 456 then
//rem will be 456%10 i.e 6 and now arr[rem] will be //arr[6] and it will increased by 1.
i=i/10;
}
}
}
for(int i=0; i<=9; i++)
cout<<arr[i]; //this will print the occurrence of all the digit