Forum Posts

Java Arrays
I have an array with {null,A,B,null,null,C,null}
Without using an ArrayList, how do I go about removing all nulls? Leaving me with {A,B,C}? 
I have 2 job offers in hand ADOBE and SAP Labs ? Which one to go with... ?
Both are in same location (Bangalore) & same job profile
Package is almost same (Adobe pays 50k more per yr).
Which would be the better company to join?
For a 2+ years Experience Candidate in IT industry....
Please do mention the reason for the company you would suggest.
Thanks in Advance :) 
Java front end developer interview questions
hello all, thanks in advance.
Iam new to software industryhere in US, i am going to have my interview next week, feeling so nervous.
So could some please share their interview experiance and also type of questions i could expeect at my interview.
I am going to have interview for Java front end developer 
BitWise Operator
Hi All,
I have a question
A country has 25 states ( can vary) and based on population of each state give a color to that state.
for e.g
state1 population is 5000
state2 population is 10000
state3 population is 12000 and so on....
now im also given colors to assign based on population
population==5000 assign green
5000<population<10000  blue
population==10000 assign orange
10000<population<15000  yellow and so on up to 100,000 ( this is the max limit of population for a state )
I can give a solution where
Step 1: create a dictionary/hashtable to maintain colors based on population.
Step 2 : Read each country population ( iterate thru countries ) and lookup in hashtable and assign.
the above solution is bruteforce.
I was given a hint to use bitwise operator for this . Any thoughts how I can go about it ?
Thanks, 
data structure
this is c program to check balanced paranthesis using stack,
i dnt know whats wrong it always showing balanced expression.
tell me what i am doing wrong.??#include<stdio.h>
void main()
{
char stk[50],exp[100];
int top=1,i;
printf("enter an expression\n");
gets(exp);
for(i=0;exp[i]!='\0';i++)
{
if(exp[i]=='(' exp[i]=='['exp[i]=='{')
{
top++;
stk[top]=exp[i];
}
else
if(exp[i]=')')
{
if(stk[top]=='(')
top;
}
else
{
printf("unbalanced exp\n");
break;
}
if(exp[i]=']')
{
if(stk[top]=='[')
top;
}
else
{
printf("unbalanced exp\n");
break;
}
if(exp[i]='}')
{
if(stk[top]=='{')
top;
}
else
{
printf("unbalanced exp\n");
break;
}
}
if(top==1)
printf("exp is balanced\n");
else
printf("exp is not balanced\n");
} 
PI
i am a btech fresher 2014 passout and looking for a job.
I have attended some interviews of tech support , usually they asked me that "why you don't go for any software job "
So help me how to answer this one 
Algorithm
There is a rope on which you will put clothes to dry. And each cloth is of different length and their starting position on the cloth is also different. Once all the clothes are put on the rope. we have to find out how many clothes are visible if i look it from top.
You are given two inputs.
1. length of the rope
2. And a list of Cloth Objects.
List<Cloth>
Cloth class is defined like this
class Cloth{
int initial Position,
int clothLength
}
for example if i am given rope length of 7
and List of cloth objects which has 3 Cloth Objects C1, C2, C3
C1.initialPosition = 0
C1.clothLength = 5(this cloth will cover from 0 to 5)
C2.initialPosition = 2
C2.clothLength = 2 (this cloth will cover from 2 to 4. since length of cloth =2)
C3.initialPosition = 1
C3.clothLength = 5 (this cloth will cover from 1 to 6. since length of cloth =5)
So with this. we can only see Cloth 1 and Cloth 3. So the output should be 2
Imagine the rope like this.
....................................................................
0 1 2 3 4 5 6 7 
LinkedList question
The code below is from the book.
public static void deleteDups(LinkedListl\lode n) {
......(many lines)
while(n.next != null)
n = n.next;
.....
}
In this situation, LinkedListNode is a class,
so if you give LikedListNode n to this method, this method receive the node n rather than the copy of n.
when using n = n.next, it change the head of the LinkedList, am I right? 
Minimize the moves
This is an online written test.
Please solve it.
You have a sequence of d[0] , d[1], d[2] , d[3] ,..,d[n]. In each move you are allowed to increase any d[i] by 1 or 2 or 5 i:0 to n .What is the minimum number of moves required to transform the sequence to permutation of [1,2,3,..,n] if it's possible else return 1.
Constraint: 1<=n<=1000
nput:
First Line will have no of elemnts
Second Line on. elements will be present
Ex: 5
1
1
3
2
1
Output:
As no of elements are 5, all permutation can be {1, 2, 3, 4, 5} .
To convert input to get all possible permutation i.e {1, 2, 5, 4, 3},
no of moves will be 4.
Hence output would be 4. 
Design a Shopping cart?
it is an interview question:
1. Design a shopping cart.
2. How the tables are stored(different tables structure)
3. How do you use http sessions?
4. Password storage rather than storing in DB.
5. How do you normalize tables?
6. Design in keeping view of using design patterns?
7. what all design patterns are used and explain? 
Zulily Interview
Does anyone happen to know what to expect for Zulily phone interview?

linked list problem
it is c program for inserting a node at the beginning of link list,..plz fix the errors in this program.
#include<stdio.h>
#include<stdlib.h>
struct node
{
int data;
struct node* next;
};
struct node* head;
void insert(int x)
{
struct node* temp=(node*)malloc(sizeof(struct node));
temp>data=x;
temp>next=NULL;
head=temp;
if(head!=NULL)
{
temp>next=head;
head=temp;
}
else
{
temp>next=head;
head=temp;
}
void print()
{
struct node* temp=head;
printf("list is: ");
while(temp!=NULL)
{
printf("%d",temp>data);
temp=temp>next;
}
printf("\n");
}
int main()
{
head=NULL; /*empty list*/
int n,i,x;
printf("how many no you want to add?\n");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("enter the no.:\n");
scanf("%d",&x);
insert(x);
print();
}
return 0;
} 
Is the "reverse a string" solution (1.2) pg 73 correct?
Hello,
I just picked up "Cracking the Coding Interview" and I started working through the first chapter's questions. I typed in the author's solution to question 1.2 and I can't see how this would work. The solution attempts to reverse a string, in place, by decrementing a pointer positioned at the last char and incrementing a pointer at the beginning of a string until the pointers meet in the middle.
The solution is as follows:
{{#include <stdio.h>
void reverse(char *str){
char *end = str;
char tmp;
while(*end){
++end;
}
end;
while(str < end){
tmp = *str;
*str++ = *end;
*end = tmp;
}
printf("str: %s\n",str);
printf("end: %s\n",end);
}
}}
I tested this solution like so:
{{int main(int argc, const char * argv[])
{
char mystring[] = "hello";
reverse(mystring);
return 0;
}
}}
This does not work. The issue is with condition in the while loop. Control is returned from the loop when both "str" and "end" are equal. In my above example the printf statements will output
str: leh
end: leh
This makes sense. It seems that the condition is expecting the values of str & end to be ordinal positions ?? Am I over looking something obvious?
Thanks! 
path/height of tree like structure
Consider the following class definition:
class Node {
List<Node> node;
void addChild (Node testNode);
}
Assume you have a node object like above. This node object can contain a child node object. Assuming you are given one of these objects, write a function to determine the maximum path length from the root node to the most distant remote node.
Its not exactly tree as it doesnt have any left and right information but it has nodes on both sides. 
I got selected in Microsoft se...
I got selected in Microsoft services global delivery for associate consultant role.how many days it will take time to release after hr asking for documents .
my exp 2.7+
interview held on 10 aug 2014 and she asked documents on 12 .please reply me when can I expect offer 
oracle 10 G job
To schedule a job which will run in weekdays between 3pm to 5pm , in a interval of 15min.
(its for oracle 10g so it doesn't support schedular
** without using repeat_interval.) 
coding
Given an array of numbers arrange it in the form of a single number such that the concluded number is the maximum. e.g. given : 99,8,76,45,66,9,7,33,5,42 O/P : 99987766654233

Resources to learn about nary tree.
Given a nary tree, Convert it into an array and return it. Construct the same nary tree from that array again.
Looking for C implementation for creation and traversal of nary tree. 
Algorithm
how to make all the elements in an array to a common element of the array in minimum time ?

c/c++ source code required
your are given square matrix of dimensions N. Let this matrix be called A.Your task is to rotate A in clockwise direction in s degrees,where s is the angle of rotation.on the matrix there will be three types of operations viz.
1.rotation
2.querying
3.updation
and print the ouput for the above types...