Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 54352e5

Browse files
Solve Me First
1 parent fbd6313 commit 54352e5

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
;; Problem Link: https://www.hackerrank.com/challenges/solve-me-first/problem
2+
3+
;; Complete the function solveMeFirst to compute the sum of two integers.
4+
5+
;; Example
6+
;; a = 7
7+
;; b = 3
8+
;; Return 10.
9+
10+
;; Function Description
11+
12+
;; Complete the solveMeFirst function in the editor below.
13+
14+
;; solveMeFirst has the following parameters:
15+
16+
;; int a: the first value
17+
;; int b: the second value
18+
;; Returns
19+
;; - int: the sum of a and b
20+
21+
;; Sample Input
22+
;; a = 2
23+
;; b = 3
24+
25+
;; Sample Output
26+
;; 5
27+
28+
;; Method 1
29+
30+
(defn solveMeFirst
31+
[x y]
32+
(+ x y)
33+
)
34+
35+
36+
(def a (read-line))
37+
(def b (read-line))
38+
39+
(println (solveMeFirst (Integer/parseInt a) (Integer/parseInt b)))
40+
41+
;; Method 2
42+
(println (#(+ %1 %2) (Integer/parseInt (read-line)) (Integer/parseInt (read-line))))

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /