Questions Set 1


Questions Set 1

Hello Friends 

I am new to this community of blogging and would love to seek help from anyone who wishes to.I am currently a student and pursuing B.Tech in Computer Science and preparing for interviews.There many platforms were you can prepare yourself for coding interviews but I feel that platforms have a lot of problems.Obviously the more questions you solve more will be your ability to ace such interviews but solving that many questions is a difficult task.That is what has made me bring this blog to you.I will be frequently putting up questions of varying difficulty in sets and I believe solving these questions will give you an idea of where you stand and what you lag.I will be posting 4 questions very often.This way not only i will be benefited but it will also help budding coders improve their skills.This is the set 1.

I will be providing the link to questions taken from different platforms or sites where you can verify your logic.You can also read the questions from this blog itself.I believe a blog series like these will help budding coders or those who have joined the coding community recently. Suggestions are always welcomed.

1-Find the missing AP term(Easy)

An Arithmetic Progression is defined as one in which there is a constant difference between the consecutive terms of a given series of numbers. You are provided with consecutive elements of an Arithmetic Progression. There is however one hitch: exactly one number from the original series is missing from the set of numbers which have been given to you. The rest of the given series is the same as the original AP. Find the missing number.

SAMPLE INPUT
 
5
1 3 5 9 11    
SAMPLE OUTPUT
 
7        



2- Swap two numbers without using a temporary variable(Easy)

Given two variables, x and y, swap two variables without using a third variable.



3-Finding Unique Element without extra space (Easy)

Given an array of integers. All numbers occur twice except one number which occurs once. Find the number in O(n) time & constant extra space.

SAMPLE INPUT
 
5
1 7 1 5 6 6 5 
SAMPLE OUTPUT
 
7  


4-Finding Unique Element extended (Medium)

Given an array in which all numbers except two are repeated once. (i.e. we have 2n+2 numbers and n numbers are occurring twice and remaining two have occurred once). Find those two numbers in the most efficient way.

SAMPLE INPUT
 
5
1 7 1 5 5 9 11 11 
SAMPLE OUTPUT
 
7  9


Comments

Popular posts from this blog

Question Set 4

Question Set 5

Question Set 2