Software Engineering Intern Interview Questions | Glassdoor.ca

Software Engineering Intern Interview Questions

31

Software engineering intern interview questions shared by candidates

Top Interview Questions

Sort: RelevancePopular Date

You have two operations: add by one and multiply by 2. Find the minimum number of operations to get from 0 to any particular integer.

2 Answers

int countOperations = 1; int currentNum = 1; while (currentNum != num){ if (currentNum * 2 > num) { currentNum++; } else currentNum*=2; countOperations++; System.out.println(currentNum); }

//the idea is to do this in reverse... as it will ensure we find the minimum number of operations //we want to leverage multiple as much as possible for large numbers. //However, we need to be able to multiply by 2 just right. //Therefore, doing that in reverse can lead to better results //for example: 9 -> 8+1 -> 1*2*2*2 + 1 -> 5 operations //for example: 10 -> 5*2 -> (1*2*2+1)*2 -> 5 operations //for example : 12 -> 6*2 -> 3*2*2 -> (1+1+1)*2*2 -> 5 operations var currentNumber = target; var operations = 1; while(currentNumber != 1) { if (currentNumber % 2 == 0) { currentNumber /= 2; } else { currentNumber -= 1; } operations += 1; } console.log(operations);

Add two linked lists Input: First List: 5->6->3 // represents number 563 Second List: 8->4->2 // represents number 842 Output Resultant list: 1->4->0->5 // represents number 1405

2 Answers

the difference between process and thread

2 Answers

Questions about bsts and running operations on them.

1 Answer

Name 5 datastructures.

1 Answer

Give a two dimentional array of registors that contains intensity value. It is feed to you one registor per cycle. How to design a hardware using FPGA to calculate the average of the 9 registors including 8 that locate right beside the center one.

1 Answer

Write a program to process a computational graph with addition and multiplication in c++

1 Answer

Was asked by a software engineer how to reverse a string using as little memory as possible.

1 Answer

*The interviewer shows an image of a screen in the cockpit of an airplane* then asked: Why are some text overlapping in the image?

1 Answer

Find the deepest common ancestor of two nodes.

1 Answer
110 of 31 Interview Questions