파이썬
-
Practice>Data Structures>Arrays>Arrays - DShackerrank.com 2019. 4. 25. 08:34
hackerrank.com Arrays - DS Problem Link : https://www.hackerrank.com/challenges/arrays-ds/problem Difficulty : Easy Tip Very common problem :-) reversing array There few ways to solve Implementing reversing array by using reverse index -1 [a[(i+1)*-1] for i in range(len(a))] Simply call reversed(a) More simpler version is 'return a[::-1]' Solution #!/bin/python3 import math import os import rand..
-
Practice>Python>Closures and Decorators>Decorators 2 - Name Directoryhackerrank.com 2019. 4. 23. 12:41
hackerrank.com Decorators 2 - Name Directory Problem Link : https://www.hackerrank.com/challenges/decorators-2-name-directory/problem Difficulty : Easy Tip Though, we could resolve the problem, still I'm a bit confused regarding decorator, anyway Please convert age to int from string, it seems that test cases are updated recently Sort people by using itemgetter(2) as age order Solution import op..
-
Practice>Python>Closures and Decorators>Standardize Mobile Number Using Decoratorshackerrank.com 2019. 4. 23. 07:58
hackerrank.com Standardize Mobile Number Using Decorators Problem Link : https://www.hackerrank.com/challenges/standardize-mobile-number-using-decorators/problem Difficulty : Easy Tip Use reverse index to substring aaaaa and bbbb from +91 aaaaa aaaaa Like aaaaa is s[-10:-5] and s[-5:0] Should uderstand how decorator work in python, it is a bit difficult Please understand how to use decorator, th..
-
Practice>Python>Regex and Parsing>Detect Floating Point Numberhackerrank.com 2019. 4. 22. 21:48
hackerrank.com Detect Floating Point Number Problem Link : https://www.hackerrank.com/challenges/introduction-to-regex/problem Difficulty : Easy Tip We can solve in two ways One is to solve by using regular expression, by detecting -, + and . The other is a way to utilize int(), float(), let's try this way We can create int() or float() from string If the given string is not proper, it will rais..