-
Practice>Python>Math>Triangle Quest 2hackerrank.com 2019. 2. 22. 13:22728x90
Triangle Quest 2
Problem link : https://www.hackerrank.com/challenges/triangle-quest-2/problemDifficulty : MediumTip
- This problem is not easy as we can use only one line
- One line means that we can't use any function
- As a first step,
- 1 x 1 = 1
- 11 x 11 = 121
- 111 x 111 = 12321
- So, how do we create 1, 11, 111 from 1, 2, 3
- (10**i)//9 <- this is a key point
- (10**1)//9 = 1
- (10**2)//9 = 11
- (10**3)//9 = 111
Solution
728x90'hackerrank.com' 카테고리의 다른 글
Practice>Python>Math>Power - Mod Power (0) 2019.02.24 hackerrank.com Practice>Python>Math>Mod Divmod (0) 2019.02.24 Practice>Python>Date and Time>Time Delta (0) 2019.02.17 Practice>Python>Collections>Collections.OrderedDict() (0) 2019.02.14 Practice>Python>Errors and Exceptions>Exceptions (0) 2019.02.14