Skip to content

Instantly share code, notes, and snippets.

@XciA
Last active August 29, 2015 14:07
Show Gist options
  • Save XciA/b7c9b46891155f55d437 to your computer and use it in GitHub Desktop.
Save XciA/b7c9b46891155f55d437 to your computer and use it in GitHub Desktop.
Interview Questions preliminary round
1)Print squares of first n natural numbers without using *, / and -
Input: n = 6
Output: 0 1 4 9 16 25
O(n) time
solution In Javascript
var square =0,prev=0;
function printSquares(n){
for(var x=0;x<n;x++){
square = (square+x+prev);
//console.log('x'+x);console.log('prev'+prev);console.log('square+x+prev'+square);
console.log(square);
prev=x;
}}
printSquares(10);
2)Given an array of n+2 element , there are two repeating number , how to find that.
n = 5;
set {4, 2, 4, 5, 2, 3, 1}
output 2 4
solution In Javascript
var arr =[4,1,4,5,2,3,2];
var length_arr = arr.length;
print_repeating(arr,length_arr)
function print_repeating(arr,l){
for(var i=0;i<l;i++){
for(var j=i+1;j<l;j++){
if(arr[i]==arr[j])console.log(arr[i]);
}}}
Time Complexity: O(n*n)
3)Logic gates
XOR - > a.!b+!a+b
00 0
01 1
10 1
11 0
4)Given a mobile number 10 digit all digits unique,how will you check for number uniqueness , no digit should repeat.
Optimization cases.
Move all zeroes to end of array
Logic Test :
You have a basket containing ten apples. You have ten friends, who each desire an apple. You give each of your friends one apple.
Now all your friends have one apple each, yet there is an apple remaining in the basket.
->each friend has an apple, and one of them has apple+basket.
MVC
mysql basics
What are design patterns in software engineering?
What did you learn yesterday/this week?
What excites or interests you about coding?
Talk about your preferred development environment. (OS, Editor or IDE, Browsers, Tools etc.)
Which version control systems are you familiar with?
Can you describe your workflow when you create a web page?
How would you optimize a websites assets/resources?
Traditionally, why has it been better to serve site assets from multiple domains?
How many resources will a browser download from a given domain at a time?
Do you have any pet projects? What kind?
What are some things you like about the developer tools you use?
What's a cool thing you've coded recently? What's something you've built that you're proud of?
What is Ajax?
asynchronous data transfer
Bandwidth utilization
More interactive
Speeder retrieval of data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment