S@iR@m
BAN USER
Senior Programmer in C, C++, Linux
- 0of 0 votes
AnswersIn an interview this question has been asked :
- S@iR@m in India
How to fit four characters into an integer, implementation should be in C programming language.
For example, four characters, viz., 'a', 'b', 'c', and 'd' need to be fit into an integer.
I tried to answer this question using ASCII value of the characters.
Please suggest the correct solution.| Report Duplicate | Flag | PURGE
Not disclosed Tech Lead C
your answer seems good only thing is if you are taking reference or pointers then any change made might impact the original so a const reference or a const pointer would be better and the usage of these three, i.e., reference, pointer, and object (pass by value) depends on the context of what is required.
- S@iR@m July 23, 2013Hi D,tox'mi, what 0OZz has said is right, the number trees has to be calculated with Catalan number and also it has to be solved by Dynamic programming so its a combination of Catalan number calculation and dynamic programming, please correct me if i am wrong, Me too also looking for this solution, i think it is not binary tree, rather, from a given set of numbers the BSTs need to be constructed.
- S@iR@m July 16, 2013IMHO this design problem can be solved by using or applying different design patterns in combination. Immediately what comes to my mind from the problem statement you can try Decorator, and Template design pattern. Decorator for catalogs having sub catalogs instead of inheritance and Template for addition of functionality at run time. Please check, a design problem might have multiple solution, the best one is based on requirement and application feasibility.
- S@iR@m July 12, 2013Hi Nikhil, I too faced the same question some times back with another organization but it was little different, in the sense, that, you can not use any extra bucket or jar, you have to do this with only 2 jars, one 5 ltr capacity and the other 3 ltr capacity with no labels or markings on the surface of the jars or bottles. I am also waiting if anybody can let me know that with only two jars how one can achieve the same that is 4 ltr as result.
- S@iR@m June 11, 2013
RepI am working as a Software quality assurance analyst in Turtle's Records company. I look for flaws and weaknesses ...
Repmarktrejjo, Data Engineer at Accolite software
I’m Mark.I believe life is too short to be serious all the time, so if you cannot laugh ...
RepI'm from India, 26 years old. I want to travel, I want a job where I can earn money ...
Repsalinagray, Development Support Engineer at Atmel
Hi I am Salina Gray,I live in Texas and work as a Design Team Member. I am new to ...
RepHello, I am Sherri from Orangeburg. I am working as a Nurse in Kleinhans Hospital. I like painting, reading, and ...
Repharryhamesh, Android Engineer at ADP
I placement officers usually work in colleges and universities. One of My friends taught me about prayers that break curses ...
if 500 mb is the ram size then definitely you might have set your virtual memory space as 4 times of that and in that case you might encounter page faults but if you are restricted only within this 500 mb of size what you can do is that in your program write your own memory handler function which will not allow you to do so. Or else you can refer external sorting methodology in this regard and please check how it gets solved there.
- S@iR@m July 23, 2013