Forum Posts
- 2 Answers About algoritham
Need algorithm
- waghela.bhavin24888 June 01, 2013
i m having a file without space, symbols and numbers. so it will be having only characters without space and any symbols. now i want valid words from that file which will be check with dictionary and If word are valid then i want to calculate its value according to game u may know Word Scramble.| Flag | PURGE - 1 Answer Cracking the Code Interview
Brain teaser 6.4!
- SovietMafioso May 31, 2013
The solution to this on page 146 is incorrect. They state that if nobody else has a hat, then you have a hat. True. If another person has a hat, there will never be a way for you to know if you have a hat or not. C could equal 1 as the problem did not specify what would happen once all hats were removed. There is no signal to let the guys know that there are no more hats, thus no way for any person to know whether they can go into the water or not.| Flag | PURGE - 11 Answers Confusion about accepting an offer from MSFT vs YHOO
Hi All,
- gsgh May 29, 2013
I have received following two offers:
1. SDET II at Microsoft (Seattle Area, WA)
2. Senior Software Dev Eng at Yahoo (Bay Area, CA)
Compensation is almost same (factoring in the state taxes in CA). The most confusing thing is the "TEST" part in MSFT offer. I have always been a developer.
Moreover I have always worked in C++ before. The position at MSFT will require me to work in C# and Yahoo is C++/Java.
Kindly advice.| Flag | PURGE - 2 Answers Strcat function()
#include<stdio.h>
- rocco May 28, 2013
char *cat(char *d,char *s)
{char *t=d;
while(*d)
d++;
d=s;
return t;
}
int main()
{
char dest[100] = "geeksfor";
char *src = "geeks";
printf(" %s ",cat(dest, src));
getchar();
}
This is my implementation of strcat func.Please xplain why its not working?| Flag | PURGE - 1 Answer Cracking the coding interview : question 1.3
What's the difference between this 2 method,
- jessica.ece2012 May 28, 2013
which one is better?
1.
char[] s_array = s.toCharArray();
for(char C : s_array)
letters[c]++;
2.
for(int i=0; i< s.length(); i++){
int c = s.charAt(i);
letters[c]++;
}
------------------
Sample solution:
public boolean permutation(String s, String t){
if(s.length() != t.length()) return false;
int[] letters = new int[256];
char[] s_array = s.toCharArray();
for(char C : s_array)
letters[c]++;
for(int i=0; i<t.length(); i++){
int c = (int) t.charAt(i);
if(--letters[c] < 0)
return false;
}
}| Flag | PURGE - 1 Answer CURRENCY SETTER ALGORITHM
The Government of Byteland has decide to issue new currency notes with special protection features to so as to commemorate a great mathematician.
- Rahul Sharma May 26, 2013
It has decided to issue notes summing up to N and all the sums from 1 to N should only made by selecting some of the notes in only one unique way.
With n = 5 the sets {1,1,1,1,1}, {1,2,2}, {1,1,3} are valid. Invalid sets are
-{1,1,1,2} because 2 can be made by {1,1} and {2}and also 3 by {1,1,1} and {1,2}
-{1,2,4} because all from 1 to 5 can be uniquely made but the sum is not 5.
Input
First line contains T(1<=T<=1000) the number of test cases. Each test case contains a integer N (<=10^9) in one line.
Output
Output the solution of each test case on a line.
Example
Input:
2
10
1000
Output:
1
13| Flag | PURGE - 10 Answers Robot Programming puzzle
there is an number line and robot is at the middle position(suppose origin).
- unknown May 22, 2013
you have command sequence like "LRLR??L?L"
L for Left
R for Right
? for left or right
You have to find the max reach either in negative or positive via this command replacing question mark with left or right.
If u have any idea just comment over it| Flag | PURGE - 0 Answers Doubts in child process creation
Hi, I am new to using system calls. As I read somewhere if I create a child process using system call fork(). The child process will contain complete code after the call.
- Rahul May 22, 2013
I wrote:
int main()
{
int i=10;
printf("I am parent %d",i);
fork();
printf("I am chile and parent %d",i);
The doubt is how come the variable i is acessbile in child proces. It should have its own stack| Flag | PURGE - 1 Answer Can Heap be represented as Linked list and vice versa
Can heap be represented as a linked list and vice-versa?
- javacode May 22, 2013
Can tree be represented as a linked list and vice-versa?
Can HashMap be represented as a linked list and vice-versa?
Can tree be represented as Hash Map?| Flag | PURGE - 0 Answers Floating point question I found online and have no idea where to start
There is an overflow issue with floating point numbers. We want to use our own data structure to define floating points numbers to avoid the overflow and truncation issue?
- mlar7891 May 18, 2013
How would you handle this question??| Flag | PURGE - 1 Answer Java Question
I have a project requirement for which I need to store the information of a users system like OS, MAC address, etc. whenever he visits the website so that we can uniquely identify the user's machine. I am developing the project in Spring MVC 3.1. Currently we are using IP address and User agent using JavaScript but both of them are not reliable and can be easily changed. Is there a way to do this through Java/JavaScript/Spring MVC. Thanks in advance.
- singal.sapna1 May 13, 2013
The same user can register multiple times. To avoid this, we need to identify the user's machine| Flag | PURGE - 2 Answers single Linked list traversal.
I want to traverse a single linked list and also want to keep record of previously visited Nodes.
- nky May 13, 2013
At any time I want to check that my current Node is visited or not.
which kind of structure provide me best way (in terms of space and time complexity)? also faster fetch for a particular Node.
points:
--about Map, but I don't want to waste space for another data as key/value. I want to insert node pointer only.
--about set, but during insertion sorting algo is used in set.
--link list itself. (what if count of nodes is very high)| Flag | PURGE