Solution-1: Using multiple if-else statements to find leap year As there are some conditions for leap year which are described in the description of the question. So, we can use those conditions in our Python solution using multiple if-else statements. Let us create a function that will ret...
HackerRank is the market-leading coding test and interview solution for hiring developers. Start hiring at the pace of innovation!
Introduction Python If-Else 10 Easy Solution.py Introduction Arithmetic Operators 10 Easy Solution.py Introduction Python: Division 10 Easy Solution.py Introduction Loops 10 Easy Solution.py Introduction Write a function 10 Medium Solution.py Introduction Print Function 20 Easy Solution.py Basic Data Ty...
Python Java ruby Sql Days of Code Days of JS Days ofStatistics react 1.1. How do I earn badges? You earn badges by solving challenges on the various practice tracks on our site. If you solve a challenge in an official HackerRank contest, you will earn points towards your progress once th...
Python中的问题解决方案。(Problem solution in Python.) T = int(input()) for t in range(T): n, m = [int(x) for x in input().strip().split()] if m == 1: print(2) else: if n % 2 == 1: print(1) else: print(2) ...
} 使用正则表达式简化代码 解决方案二: staticList<Integer> compareTriplets(List<Integer> a, List<Integer>b) {intaWin = 0;intbWin = 0; List<Integer> win =newLinkedList<Integer>();for(inti = 0; i < a.size(); i++) {if(a.get(i) >b.get(i))++aWin;elseif(a.get(i) yforx, ...
order if M is odd or the average number of the middle 2 numbers (again after sorting) if M...
order if M is odd or the average number of the middle 2 numbers (again after sorting) if M...
30 days of code solution in C++/JAVA/C/Python/JavaScript/C# www.hackerrank.com/domains/tutorials/30-days-of-code Topics hacktoberfest hackerrank-solutions hackerrank-30dayschallange Resources Readme License GPL-3.0 license Code of conduct Code of conduct Stars 110 stars Watchers 6 watch...
C++足够快,你可以摆脱低效。Python更慢,这个算法不再足够好。不是将数据存储在值数组中,而是存储在...