Forum Posts
- 0 Answers C program
Write a complete C program that will allow you to enter and maintain a computerized version of your
- shihan.viswa December 04, 2013
family tree. Begin by specifying the number of generations (i.e. the number of lever within the tree.)
Then enter the names and nationalities in a hierarchical fashion, beginning with our own name and
nationality. Include capabilities for modifying the tree and for adding new names (new nodes) to the
tree. Also, include a provision for displaying the entire tree automatically after each update.| Flag | PURGE - 3 Answers How to delete an account?
I've emailed careercup support 5+ times already (no response) about having this account deleted. Does anyone work actively on this site at all?
- S O U N D W A V E November 27, 2013
I occasionally get emails for recent comments to questions even though I'm not subscribed to this.
The unsubscribe link in this email leads to nothing useful (as I'm not subscribed to this service to begin with).
How do I contact the people who run careercup? How to stop the sporadic spam emails?
I just got this email (which is considered spam now) :
undefined has commented on a question.
You are given an array in which you’ve to find a subarray such that the sum of elements in it is equal to zero.
He algo is nice.
However, In java it is not easy using the hashMap to get the key of values if we use hashmap(index,value). And if we want to use hashtable(value,index), the array cannot have dup as it will have the same key and cover the previous value. We can use a biMap to handle it.
if we don't want to use biMap here is my solution using two hashMap.
static void sumEqZero()
{snip}
View » | To unsubscribe, login and click here.| Flag | PURGE - 5 Answers search an element in an array where adjacent numbers differ by +1 or -1
Give an array { 5, 6 , 7, 6, 5,4,5,4,3,2,1} where each adjacent element is differ by +1 or -1, Now give an number(say 6) and nth occurrence, we need to return the index of the element?
- babusek November 26, 2013| Flag | PURGE - 1 Answer Google Question
Most people have adopted the decimal number system which has ten symbols (0,1,2,3,4,5,6,7,8,9). There are other number systems like binary, hex and octal. Your job is to convert a hex number into a musical number. What is a musical number you might ask? It’s something we invented. Keep reading.
- sandeep17199117 November 26, 2013
The Hex alphabet contains 16 symbols: 0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f
The Musical alphabet contains 12 symbols: A,A#,B,C,C#,D,D#,E,F,F#,G,G# (# is pronounced 'sharp' so 'A#' is pronounced 'A-sharp', 'C#' is 'C-sharp' and so on)
Your program should validate input (make sure input is a hex number i.e. it is in base-16) and convert it to a number represented by the musical alphabet (base-12). Your program should output the musical number OR an error string "Input is not valid Hex" if the input is not valid hex| Flag | PURGE - 1 Answer Applying to multiple branches of same company
How does Google view it if we apply to its different branches separately? Are they all considered separately(separate set of interviews)? If I get into one branch am I barred from going to another branch?
- peanuts November 25, 2013| Flag | PURGE - 1 Answer How to test Amazon.com website?
Can someone help me with some out-of-box thinking to answer this question? How should I approach such an interview question? What followup questions should I ask to clarify?
- amazontester00 November 16, 2013
Any suggestion will be greatly appreciated...| Flag | PURGE - 2 Answers json groovy
def slurper = new JsonSlurper()
- mr.prashanthsharma November 12, 2013
def result = slurper.parseText('{"person":{"name":"Guillaume","age":33,"pets":["dog","cat"]}}')
the above is my code to extract value "Guillaume" from the above json object but I am stuck in next step| Flag | PURGE - 1 Answer Best optimization for reading stdin
Folks ,
- freak88delhi November 10, 2013
I have to optimize a code for below scenario. Please help
I am reading stdin (a file redirected to stdin) character by character. How many chars are going to come is not known. After every few chars there is a seaparator. e.g $ as below
rhhrkkj$hghjhdf$ddfkrjt
While reading, if the separator arrives I'm processing the string stored before that separator and then continue reading stdin in same fashion, till EOF. I am using getc(stdin) to read chars.
Using gprof I can see most of the program time is spent inside main() , for this reading logic. Rest of the program is just some insert and search operations. I am getting time of 0.01 secs at the moment, want to reduce further.| Flag | PURGE - 7 Answers Space complexity for Recursive Binary Search
Space complexity for Iterative Binary Search would obviously be O(1) but with the recursive algorithm I believe the stack would use O(log n) space. However, everywhere I read I see the worst case complexity for BS O(1). Could someone please help me understand.
- teli.vaibhav November 07, 2013| Flag | PURGE - 0 Answers Increasing Digital Subsequence Problem
Hi,
- abhi1988srivastava October 30, 2013
I was going through the Jeff Erikson notes on Dynamic programming and got stuck with one of the questions in the exercise. Here my pasting the complete question :
Let D[1.. n] be an array of digits, each an integer between 0 and 9. An digital subsequence of
D is an sequence of positive integers composed in the usual way from disjoint substrings of D.
For example, 3,4,5,6,8,9,32,38,46,64,83,279 is an increasing digital subsequence of the first
several digits of :
3 , 1, 4 , 1, 5 , 9, 2, 6 , 5, 3, 5, 8 , 9 , 7, 9, 3, 2 , 3, 8 , 4, 6, 2, 6, 4 , 3, 3, 8, 3 , 2, 7, 9
The length of a digital subsequence is the number of integers it contains, not the number of digits;the preceding example has length 12.
Describe and analyze an efficient algorithm to compute the longest increasing digital subsequence of D.
I thought of starting it with LIS restrircing to single digit number and adding 1 to it but how to compare for range of values like comparing for two k digits.
(restricting to single digit):
DS(i) = 1+ max{DS(j)} where j<=9 and A[i]>A[j]
Please help.
Regards
Abhinav| Flag | PURGE - 1 Answer Can you help me with some C code.
PROBLEM STATEMENT:
- Feurer October 28, 2013
Calculator Language (CL) supports assignment, positive and negative integers and simple
arithmetic. The allowable characters in a CL statement are thus:
A..Z : Variables
0..9 : Digits
+ : Addition operator
- : Subtraction operator
* : multiplication operator
/ : integer division operator
= : assignment operator
() : brackets
- : negative sign
All operators have the same precedence and are right associative, thus 15 - 8 - 3 = 15 - (8 - 3) = 10.
As one would expect, brackets will force the expression within them to be evaluated first. Brackets
may be nested arbitrarily deeply. An expression never has two operators next to each other (even
if separated by a bracket), an assignment operator is always immediately preceded by a variable
and the leftmost operator on a line is always an assignment. For readability, spaces may be freely
inserted into an expression, except between a negative sign and a number. A negative sign will not
appear before a variable. All variables are initialised to zero (0) and retain their values until changed
explicitly.
Write a program that will accept and evaluate expressions written in this language. Each expression
occupies one line and contains at least one assignment operator, and maybe more.
Input
Input will consist of a series of lines, each line containing a correct CL expression. No line will be
longer than 100 characters. The file will be terminated by a line consisting of a single #.
Output
Output will consist of a series of lines, one for each line of the input. Each line will consist of a
list of the final values of all variables whose value changes as a result of the evaluation of that
expression. If more than one variable changes value, they should be listed in alphabetical order,
separated by commas. If a variable changes value more than once in an expression, only the
final value is output. A variable is said to change value if its value after the expression has been
evaluated is different from its value before the expression was evaluated. If no variables change
value, then print the message `No Change'. Follow the format shown below exactly.
Sample input
A = B = 4
C = (D = 2)*_2
C = D = 2 * _2
F = C - D
E = D * _10
Z = 10 / 3
#
Sample output
A = 4, B = 4
C = -4, D = 2
D = -4
No Change
E = 40
Z = 3| Flag | PURGE