there r lot of stuff for this in algogeeks.plz u all r requested to post
these kind of quries on interview-street..i can tell u this last tym...
for testing profyl questions will be :
1.u open word fyl and do wrk and save...what can be test cases that error
can pccur.
2. u taking to frnd
Given a positive number N, find a minimum number M greater than N, M has
the same length with N and the sum of the bits are equal.
example:
N=134 , M=143, // 1+3+4=1+4+3
N=020, M = 101, //2=1+1
the length of N is less than 1000.
--
You received this message because you are subscribed to the
Is it sum of bits or sum of digits ?
On Sun, Oct 9, 2011 at 1:39 PM, wujin chen wujinchen...@gmail.com wrote:
Given a positive number N, find a minimum number M greater than N, M has
the same length with N and the sum of the bits are equal.
example:
N=134 , M=143, // 1+3+4=1+4+3
N=020, M
Answer won't be possible in for each N. What would be answer for N=999 ?
On Sun, Oct 9, 2011 at 4:22 PM, Ankur Garg ankurga...@gmail.com wrote:
Is it sum of bits or sum of digits ?
On Sun, Oct 9, 2011 at 1:39 PM, wujin chen wujinchen...@gmail.com wrote:
Given a positive number N, find a
Provide link for interview street in this same threadthe another
thread has been deleted it seems...
On Oct 9, 10:35 am, shady sinv...@gmail.com wrote:
well new group is already there so people can post job related questions,
book requests there... those who are genuinely interested in
Hi,
In the following programming when i gave character input rather
than integer , the following scanf statement is not working . so i introduce
the fflush(stdin) before the last scanf statement.
But i get the same error as i before .
#includestdio.h
int
@Ankur ,
as example:
N=134 , M=143, // 1+3+4=1+4+3
N=020, M = 101, //2=1+1
I mean the sum of digits.
2011/10/9 Ankur Garg ankurga...@gmail.com
Is it sum of bits or sum of digits ?
On Sun, Oct 9, 2011 at 1:39 PM, wujin chen wujinchen...@gmail.com wrote:
Given a positive number N, find a
@Aamir , yes, for some N, it will be no ans, then return -1.
2011/10/9 Aamir Khan ak4u2...@gmail.com
Answer won't be possible in for each N. What would be answer for N=999 ?
On Sun, Oct 9, 2011 at 4:22 PM, Ankur Garg ankurga...@gmail.com wrote:
Is it sum of bits or sum of digits ?
On
Everyone please join it. Discuss whatever you want related to companies over
there. :) environment, culture, growth
http://groups.google.com/group/interview-street/
On Sun, Oct 9, 2011 at 5:44 PM, siva viknesh sivavikne...@gmail.com wrote:
Provide link for interview street in this same
for N=020, M = 101, //2=1+1
why are you adding 0 before 20, just give -1 as the answer.
if adding 0 is allowed then we can give answer for all inputs
for N=999
make it as N=0999, M=1899
On Oct 9, 5:04 pm, wujin chen wujinchen...@gmail.com wrote:
@Aamir , yes, for some N, it will be no ans, then
sumOfDigits(i) - simply sums all the digits and returns the value.
sortDigits() - takes a number and return the lowest possible number
possible with digits of param passed.
flag = false;
for(int i=n+1, i 1000; i++) //mention to go upto 1000 in problem
{
if(sumOfDigits(i) == sumOfDigits(n))
{
//a
@Navneet, i mean the length of N is less than 1000, not the value of N .
*so, N maybe cannot be represented in 32bit . 10^1000-1 is huge number~~
*
2011/10/9 Navneet navneetn...@gmail.com
sumOfDigits(i) - simply sums all the digits and returns the value.
sortDigits() - takes a number and return
just take input a and b in one statement like this scanf(%d %d ,a ,b);
On Sun, Oct 9, 2011 at 4:50 PM, Saravanan Selvamani
saravananselvam...@gmail.com wrote:
Hi,
In the following programming when i gave character input rather
than integer , the following scanf statement is not
After scanning the variable a, you will give a whitespace
character(space,tab or newline), which will also get stored into stdin file.
So next statement will scan this whitespace character.
fflush(stdin) flushes(clears) the contents of stdin file, so this time scanf
will not get whitespace
Sorry for previous email, did not read the question properly.
Sanju
:)
On Sun, Oct 9, 2011 at 7:12 PM, Sanjay Rajpal srn...@gmail.com wrote:
After scanning the variable a, you will give a whitespace
character(space,tab or newline), which will also get stored into stdin file.
So next
these are some lines form fflush man pages
For output streams, fflush() forces a write of all user-space buffered data
for the given output or update stream via the stream's underlying write
function. *For input streams, fflush() discards any buffered data that has
been fetched from the
-- Forwarded message --
From: Rajesh Kumar testalgori...@gmail.com
Date: Sun, Oct 9, 2011 at 2:58 PM
Subject: why we can not swap values using macro?
To: algogeeks@googlegroups.com
why this code doesn't swap values of x and y?
#includestdio.h
#define swap(a,b,c) c t;t=a,a=b,b=t;
because you have not made any call to swap values of x and y
I Don't know what you are trying to do here
if you want to swap values why are you not calling macro swap(x,y,int)
you are making a macro call to swap pointers and you can check that pointer
will get swapped.
On Sun, Oct 9, 2011 at
don't fflush(stdin) it doesn't make any sense.
fflush(stdout) and fflush(stderr) only.
On Sun, Oct 9, 2011 at 8:20 AM, Saravanan Selvamani
saravananselvam...@gmail.com wrote:
Hi,
In the following programming when i gave character input rather
than integer , the following scanf
Given an unsorted array of Integers
Find 2 nos whose diff is minimum
Say Array is 4 2 18 19 11 8 5
Nos are 18 and 19
Algo shud be of O(n)
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
Given a 2D matrix which is both row wise and column wise sorted. Propose an
algorithm for finding the kth smallest element in it in least time
complexity
A General Max Heap can be used with k space and n+klogk complexity
Any other solution or even a way by which we dont scan the whole matrix to
im assuming it be a square matrix
then kth smallest element will be in a first k*k sub matrix.
jst look for smallest element in the diagonal of this matrix.
it will give the kth smallest element .
On Mon, Oct 10, 2011 at 4:45 AM, Ankur Garg ankurga...@gmail.com wrote:
Given a 2D matrix which
I think Min heap will do that..
On Mon, Oct 10, 2011 at 12:37 AM, Ankur Garg ankurga...@gmail.com wrote:
Given an unsorted array of Integers
Find 2 nos whose diff is minimum
Say Array is 4 2 18 19 11 8 5
Nos are 18 and 19
Algo shud be of O(n)
--
You received this message because you
@Shubham: So if the matrix is
1 2
3 4
and you want the 2nd smallest, are you saying that it is 4?
Dave
On Oct 9, 7:40 pm, shubham goyal shubhamgoyal.n...@gmail.com wrote:
im assuming it be a square matrix
then kth smallest element will be in a first k*k sub matrix.
jst look for smallest
24 matches
Mail list logo