Chronus Interview Question for Software Engineer / Developers






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

Is it not enough to check weather the array contains elements which are divisible by 3*5*7.

- appu October 09, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

This is a standard question available in cracking the coding interview book..!! Have a look at it..!!

- keerthy January 04, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

In the book, step 6, when we find the smallest number x among Q3,Q5,Q7, and why if x is in Q5, we only append x*5,x*7 in Q5 and Q7(same to when x is in Q7), how we can make sure x*3 is ready exist in the list? Thanks, need tips.

- newy February 21, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

#include<iostream>

using namespace std;

int getNthNumber(int number,int Number[]){
    int five,seven,three,nextNumber;
    five=seven=three=0;
    Number[0]=1;

    for(int i=1;i<number;i++){
            nextNumber=min(min(Number[five]*5,Number[seven]*7),min(Number[five]*5,Number[three]*3));
            if(nextNumber==Number[five]*5)
                five++;
            if(nextNumber==Number[seven]*7)
                seven++;
            if(nextNumber==Number[three]*3)
                three++;
            Number[i]=nextNumber;
    }

    return nextNumber;
}

int main(){
    int number=6;int Number[150];
    cout<<getNthNumber(number,Number);
    return 0;
}

- Nothing Great August 18, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

//Print out all prime numbers from 1 to n
private static void printOutAllPrimeNumbers(int n)
{
int i = 0, j = 0;

bool prime = true;

for (i = 1; i < n; i++)
{
prime = true;

for (j = 2; j <= i / 2; j++)
{
if (i % j == 0)
prime = false;
}
if (prime == true)
Console.WriteLine(i);
}
}

- friend August 04, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Kindly think before posting.
Its obviously wrong.
Only numbers of the form N= 3^p * 5 ^q * 7^r 0<=p,q,r are needed
Use 3 stacks - one each for powers of 3,5,7
The smallest is 3 * 5^0 * 7^0.Push/Pop an element to stack(s) which is next highest number from previous number.
Eg: k =1 => 3^1 * 5^0 * 7^0,
k = 2 => 3*1 * 5^1 * 7^0
k = 3 => 3^2 * 5^1 * 7 ^0
k = 4 => 3^1 * 5^2 * 7^0
so on.. you need to keep popping from a stack to find the next highest number.

- Sriram S August 04, 2011 | Flag
Comment hidden because of low score. Click to expand.
-1
of 1 vote

considering the array as sorted in ascending order...one can check that whether the number has only 3 5 and 7 as factors...if yes then increment the count...when the count reaches k then print that number...

The code to check whether the number i s factor of 3 5 and 7 is--

//code to divide the number by max power of 3 or 5 or 7
int maxdivide(int n, int m)
{
if((n%m) == 0)
n = n/m;

return n;
}


//code to check whether the number is multiple of 3 5 and 7 only
int check(int n)
{
if(n>1)
n = maxdivide(n,3);

if(n>1)
n = maxdivide(n,5);

if(n>1)
n = maxdivide(n,7);

if(n==1)
return 1;
else return 0;
}

- beginner August 07, 2011 | 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