본문 바로가기

hacker rank38

hackerrank Occupations https://www.hackerrank.com/challenges/occupations/problem?isFullScreen=true Occupations | HackerRank Pivot the Occupation column so the Name of each person in OCCUPATIONS is displayed underneath their respective Occupation. www.hackerrank.com 1 2 3 4 5 6 7 8 9 10 select min(case when occupation = 'Doctor' then name end) 'Doctor', min(case when occupation = 'Professor' then name end) 'Professor',.. 2022. 11. 13.
Hacker rank Find the Median 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 #!/bin/python3 import math import os import random import re import sys # # Complete the 'findMedian' function below. # # The function is expected to return an INTEGER. # The function accepts INTEGER_ARRAY arr as parameter. # def findMedian(arr): # Write your code here arr=sorted(arr) cnt=len(arr) return ar.. 2021. 10. 28.
Hacker rank Strong Password 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 #!/bin/python3 import math import os import random import re import sys # # Complete the 'minimumNumber' function below. # # The function is expected to return an INTEGER. # The function accepts following parameters: # 1. INTEGER n # 2. STRING password # def minimum.. 2021. 10. 28.
Hacker rank CamelCase 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 #!/bin/python3 import math import os import random import re import sys # # Complete the 'camelcase' function below. # # The function is expected to return an INTEGER. # The function accepts STRING s as parameter. # def camelcase(s): # Write your code here ans=1 for i in s: if i.isupper()==True: ans+=1 retu.. 2021. 10. 28.
Hacker rank Sparse Arrays 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 #!/bin/python3 import math import os import random import re import sys # # Complete the 'matchingStrings' function below. # # The function is expected to return an INTEGER_ARRAY. # The function accepts following parameters: # 1. STRING_ARRAY strings # 2.. 2021. 10. 28.
Hacker rank Left Rotation 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 #!/bin/python3 import math import os import random import re import sys from collections import deque # # Complete the 'rotateLeft' function below. # # The function is expected to return an INTEGER_ARRAY. # The function accepts following parameters: # 1. INTEGER d # 2. INTEGER_ARRAY .. 2021. 10. 28.
Hacker rank Arrays - DS 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 #!/bin/python3 import math import os import random import re import sys # # Complete the 'reverseArray' function below. # # The function is expected to return an INTEGER_ARRAY. # The function accepts INTEGER_ARRAY a as parameter. # def reverseArray(a): # Write your code here a=reversed(a) return a if __name.. 2021. 10. 26.
Hacker rank Big Sorting 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 #!/bin/python3 import math import os import random import re import sys # # Complete the 'bigSorting' function below. # # The function is expected to return a STRING_ARRAY. # The function accepts STRING_ARRAY unsorted as parameter. # def bigSorting(unsorted): # Write your code here unsorted= sorted.. 2021. 10. 26.
Hacker rank Time Conversion 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 #!/bin/python3 import math import os import random import re import sys # # Complete the 'timeConversion' function below. # # The function is expected to return a STRING. # The function accepts STRING s as parameter. # def timeConversion(s): # Write your code here s=s.split(':') hh=int(.. 2021. 10. 26.
Hacker rank Birthday Cake Candles 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 #!/bin/python3 import math import os import random import re import sys # # Complete the 'birthdayCakeCandles' function below. # # The function is expected to return an INTEGER. # The function accepts INTEGER_ARRAY candles as parameter. # def birthdayCakeCandles(candles): # Write your code here return candles.cou.. 2021. 10. 26.
Hacker rank Mini-Max Sum 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 #!/bin/python3 import math import os import random import re import sys # # Complete the 'miniMaxSum' function below. # # The function accepts INTEGER_ARRAY arr as parameter. # def miniMaxSum(arr): # Write your code here ans=sum(arr) print (ans-max(arr), ans-min(arr)) if __name__ == '__main__': arr = list(map(int, input().rstrip().sp.. 2021. 10. 26.
Hacker rank Staircase 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 #!/bin/python3 import math import os import random import re import sys # # Complete the 'staircase' function below. # # The function accepts INTEGER n as parameter. # def staircase(n): # Write your code here for i in range(n): print(" "*(n-i-1),end='') print("#"*(i+1)) if __name__ == '__main__': n = int(input().strip()) staircase(n).. 2021. 10. 26.