Skill Subsist Impulse Ltd Interview Question for Software Engineer / Developers


Country: India
Interview Type: Written Test




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

This is the famous Collatz sequence : en.wikipedia.org/wiki/Collatz_conjecture .
There are many papers on it.

- NoOne October 10, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

void f(int n)
{ if(n%2==0){return f(n/2);}
else{return f(3n+1);}
}

- ashishkamble191191 September 27, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Here's a complete Java answer:

public class BasicRecursion
{
	public static void main(String[] args)
	{
		System.out.println("Basic Recursion");		
		System.out.println("Write a recursive function to compute f(n)=n⁄2 when n is even; f(n)=f(3n+1)when n is odd.");
		System.out.println("---");

		java.util.Random r = new java.util.Random();
		int input = r.nextInt(1000);
		System.out.println("Input : " + input);

		int answer = compute(input);
		System.out.println("Answer : " + answer);
	}

	public static int compute(int n)
	{
		if(n % 2 == 0)
		{
			return n/2;
		}
		return compute(3*n + 1);
	}
}

- Mick Byrne October 02, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Can sumone pls upload a dp soln of this question ?

- Rishabh Dubey October 05, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

can sumone pls upload a dp soln of this ques ?

- Rishabh Dubey October 05, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

int fun(int n){
if(n%2==0)
retrun n;
else
return fun(3*n+1);
}

- D PRAVEEN KUMAR October 06, 2016 | 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