File tree Expand file tree Collapse file tree 1 file changed +126
-30
lines changed Expand file tree Collapse file tree 1 file changed +126
-30
lines changed Original file line number Diff line number Diff line change @@ -4,44 +4,140 @@ Build a Restful API for a simple application using Node.js, Express and MongoDB.
4
4
5
5
## Steps to Setup
6
6
7
- 1 . Install dependencies
7
+ 1 . Right-click ‘dot.java’ class and select Run As->Java Application
8
8
9
- ``` bash
10
- npm install
11
- ```
9
+ 2 . Output will be displayed in the Eclipse IDE->Console
12
10
13
- 2 . Run Server
14
11
15
- ``` bash
16
- node server.js
17
- ```
12
+ ## Test development example
18
13
19
14
20
- ## Test development example
21
15
22
- Method: POST
23
- > Endpoint: /object
24
- > Body: JSON: {"mykey" : "value1"}
25
- > Time: 6.00 pm
26
- > Response: {"key":"mykey", "value":"value1", "timestamp": time } //Where time is timestamp of the post request (6.00pm).
16
+ ## 1. Factorials
17
+
18
+ For an input N = 25, output will be 15511210043330985984000000.
19
+
20
+
21
+ ## 2. Sorting
22
+
23
+ Given an array with n elements, sort this array in ascending order using only one of the following operations.
24
+
25
+
26
+ ### Sample Input #1
27
+
28
+ > 2
29
+ >
30
+ > 4 2
31
+
32
+ ### Sample Output #1
33
+
34
+ > yes
35
+ > swap 1 2
36
+
37
+ ### Sample Input #2
38
+
39
+ > 3
40
+ > 3 1 2
41
+
42
+ ### Sample Output #2
43
+
44
+ > no
45
+
46
+ ### Sample Input #3
47
+
48
+ > 6
49
+ >
50
+ > 1 5 4 3 2 6
51
+
52
+ ### Sample Output #3
53
+
54
+ > yes
55
+ > reverse 2 5
56
+
57
+
58
+ ## 3. Matrix Rotation
59
+
60
+ ### Sample Input #00
61
+
62
+ > 4 4 1
63
+ >
64
+ > 1 2 3 4
65
+ >
66
+ > 5 6 7 8
67
+ >
68
+ > 9 10 11 12
69
+ >
70
+ > 13 14 15 16
71
+
72
+ ### Sample Output #00
73
+
74
+ > 2 3 4 8
75
+
76
+ > 1 7 11 12
77
+
78
+ > 5 6 10 16
79
+
80
+ > 9 13 14 15
81
+
82
+ ### Sample Input #01
83
+
84
+ > 4 4 2
85
+
86
+ > 1 2 3 4
87
+
88
+ > 5 6 7 8
89
+
90
+ > 9 10 11 12
91
+
92
+ > 13 14 15 16
93
+
94
+ ### Sample Output #01
95
+
96
+ > 3 4 8 12
97
+
98
+ > 2 11 10 16
99
+
100
+ > 1 7 6 15
101
+
102
+ > 5 9 13 14
103
+
104
+ ### Sample Input #02
105
+
106
+ > 5 4 7
107
+
108
+ > 1 2 3 4
109
+
110
+ > 7 8 9 10
111
+
112
+ > 13 14 15 16
113
+
114
+ > 19 20 21 22
115
+
116
+ > 25 26 27 28
117
+
118
+ ### Sample Output #02
119
+
120
+ > 28 27 26 25
121
+
122
+ > 22 9 15 19
123
+
124
+ > 16 8 21 13
125
+
126
+ > 10 14 20 7
127
+
128
+ > 4 3 2 1
129
+
130
+ ### Sample Input #03
131
+
132
+ > 2 2 3
133
+
134
+ > 1 1
27
135
28
- Method: GET
29
- > Endpoint: /object/mykey
30
- > Response: {"value": "value1" }
136
+ > 1 1
31
137
32
- Method: POST
33
- > Endpoint: /object
34
- > Body: JSON: {"mykey" : "value2"}
35
- > Time: 6.05 pm
36
- > Response: {"key":"mykey", "value":"value2", "timestamp": time } //Where time is timestamp of the new value (6.05pm).
138
+ ### Sample Output #03
37
139
38
- Method: GET
39
- > Endpoint: /object/mykey
40
- > Response: {"value": "value2" }
140
+ > 1 1
41
141
42
- Method: GET
43
- > Endpoint: /object/mykey/timestamp=1440568980 [ 6.03pm] // notice that the time here is not exactly 6.00pm
44
- > Response: {"value": "value1" } // still return value 1 , because value 2 was only added at 6.05pm
142
+ > 1 1
45
143
46
- Note: use /object/mykey/timestamp=1440568980 instead of /object/mykey?timestamp=1440568980
47
- > Endpoint: /object/mykey/timestamp=1440568980
You can’t perform that action at this time.
0 commit comments