AnonD
BAN USER- 3of 3 votes
AnswersFind out if the given string forms a valid lottery number.
- AnonD in United States
- A valid lottery number contains 7 unique digits between 1 and 59.
e.g.
4938532894754 (yes) -> 49 38 53 28 9 47 54
1634616512 (yes) -> 1 6 34 6 16 51 2
1122334 (no)| Report Duplicate | Flag | PURGE
Facebook Software Developer - 0of 0 votes
AnswerDesign an object oriented console application named universe that reads in a file containing the schema of a two
- AnonD in United States
dimensional (2D) universe and outputs certain information about the universe.
A 2D universe is a simplified universe that contains galaxies, stars, and planets, all of which are located on a flat plane
specified using 2-coordinates (x-axis and y-axis).
There is only one universe and it contains one or more galaxies.
A galaxy may contain one or more stars located in it.
A star may contain zero or more planets located near it in the same galaxy.
A planet may belong to one or two stars located near it in the same galaxy (Planet E465D in the sample file below is an example).
In order to allow the objects to support more descriptive attributes and functionality in future revisions of the
application, all the object types described above should be represented using separate classes. Parent-Child relationships should also be represented using links between the various object instances.
The program will run with three arguments specified: the input-file, and the name of two objects of any type, A and B.
Example command-line: universe text.txt Alpha_Dra E465D
Based on the command line arguments specified, the program will compute and display:
1. The parents location for both object A and B. (If needed, assume the coordinate of the universe is 0,0)
2. The minimum distance between object A (Alpha_Dra) and B (E465D). This is the distance between the two objects
given locations.
3. Any of the two closest stars in the entire universe.
4. The farthest object from A, that is of the same type as A; and the farthest object from B, that is of the same type as
B. (if one exists)
The input file contains new-line separated lines each describing one object using the format:
Type|Unique-Name|X-Coordinate|Y-Coordinate|Parent’s-Name|
Example test.txt input file:
Galaxy|Draco|75434.2|89151.4|Universe|
Star|Beta_And|23315.83|-2234.73|Andromeda|
Star|Alpha_Dra|75243.25|84123|Draco|
Galaxy|Andromeda|2967.78|-2357.2|Universe|
Planet|P165EU|75242.42|84121.2|Alpha_Dra|
Star|Alpha_And|26413.83|-2727.73|Andromeda|
Planet|E465D|26412.4|-2726.51|Alpha_And|
Planet|E465D|26412.4|-2726.51|Beta_And|
Notes:
The Universe object that serves as a parent to the galaxies is implicit, and will not be explicitly defined in the input
file.
The input lines may occur in any order
The file may contain millions of lines.
Example output of running: universe test.txt Alpha_Dra E465D
Parent of Alpha_Dra is located at: 75434.2,89151.4
Parent of E465D is located at: 26413.83,-2727.73
Distance between Alpha_Dra and E465D: 99635.8
Closest two stars in the universe are: Alpha_And and Beta_And| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm - 3of 3 votes
AnswersPrint the level of friendship.
- AnonD in United States
Given a person and list of his friends, print all his friends by level of association.
The text file will be like one below
A: B,C,D
D: B,E,F
E: C,F,G
If the input is A, the out put should be:
Level 1 - B,C,D
Level 2 - E,F
Level 3 - G| Report Duplicate | Flag | PURGE
Amazon Software Engineer Algorithm
RepOliviaJBlack, Consultant at Apkudo
I am Olivia from San Diego. I am working as a checker in the Thom McAn Store company. My strong ...
This was a written test. So they were looking for a well designed big free code that does the job.
- AnonD June 25, 2015