Open in app

Sign In

Write

Sign In

Shounak Lohokare
Shounak Lohokare

16 Followers

Home

About

Jan 30, 2021

Separate the Numbers : HackerRank Solution in Python

Solution in Python 3 def separateNumbers(s): if len(s)==1: print("NO") return for i in range(1, len(s)//2+1): genstr = s[:i] prev = int(genstr) while len(genstr) < len(s): next = prev+1 genstr+=str(next) prev = next if genstr == s: print("YES", s[:i]) return print("NO") Explanation

Seperate The Numbers

2 min read

Separate the Numbers : HackerRank Solution in Python
Separate the Numbers : HackerRank Solution in Python
Seperate The Numbers

2 min read


Jan 21, 2021

Overview of Web Scraping with Python’s BeautifulSoup and requests library

Web Scraping is the process of collecting structured data from web sites, Suppose you want to monitor price of a specific stock from a website and store it in your computer it would be tedious to copy the price from the website everyday, here’s where Web Scraping comes into play…

Web Scraping

4 min read

Overview of Web Scraping with Python’s BeautifulSoup and requests library
Overview of Web Scraping with Python’s BeautifulSoup and requests library
Web Scraping

4 min read


Jan 12, 2021

DefaultDict Tutorial : HackerRank Solution in Python

Solution in Python 3 Link:- DefaultDict (github.com) from collections import defaultdict n, m = map(int, input().split()) d = defaultdict(list) for i in range(n): d[input()].append(i+1) for j in range(m): s = input() if s in d: print(*d[s]) else: print(-1) Explanation First we will import defaultdict from collections module of Python. Then we will accept n and…

Defaultdict Tutorial

2 min read

DefaultDict Tutorial : HackerRank Solution in Python
DefaultDict Tutorial : HackerRank Solution in Python
Defaultdict Tutorial

2 min read


Jan 8, 2021

Picking Numbers : HackerRank Solution in Python

Solution in Python 3 from collections import Counter def pickingNumbers(a): countNums = Counter(a) maxnum=0 for i in range(1, 100): maxnum = max(maxnum, countNums[i]+countNums[i+1]) return maxnum Explanation We will import Counter from Python’s collections module. A Counter is a container that stores elements as dictionary keys and their counts or occurrences in a data structure as…

Picking Numbers

2 min read

Picking Numbers : HackerRank Solution in Python
Picking Numbers : HackerRank Solution in Python
Picking Numbers

2 min read


Jan 2, 2021

Sales by Match : HackerRank Solution in Python

Solution in Python 3 def sockMerchant(n, ar): countOfSocks = [] for sock in set(ar): countOfSocks.append(ar.count(sock)) return sum([i//2 for i in countOfSocks]) Explanation First, we will declare an empty list, countOfSocks. In which we will store the count of each type of sock. countOfSocks = [] Then, we will iterate over the set of ar through…

Sales By Match

2 min read

Sales by Match : HackerRank Solution in Python
Sales by Match : HackerRank Solution in Python
Sales By Match

2 min read


Dec 28, 2020

Day of the Programmer : HackerRank Solution in Python

Solution in Python 3 Link:- DOFTP (github.com) def dayOfProgrammer(year): if year < 1700 or year > 2700: return elif year==1918: return '26.09.1918'…

Day Of The Programmer

3 min read

Day of the Programmer : HackerRank Solution in Python
Day of the Programmer : HackerRank Solution in Python
Day Of The Programmer

3 min read


Dec 25, 2020

Beautiful Days at the Movies : HackerRank Solution in Python

Solution in Python 3 🔗BDAM (github.com) def beautifulDays(i, j, k): beautifulDays = 0 for day in range(i, j+1): rev = int(str(day)[::-1]) if abs(rev-day)%k==0: beautifulDays+=1 return beautifulDays Explanation Firstly we declare a variable called beautifulDays and initialize it to 0. beautifulDays = 0 Then, we use a for loop and iterate from i i.e the starting…

Beautiful Days At Movies

2 min read

Beautiful Days at the Movies : HackerRank Solution in Python
Beautiful Days at the Movies : HackerRank Solution in Python
Beautiful Days At Movies

2 min read


Dec 21, 2020

ACM ICPC Team : HackerRank Solution in Python

Solution in Python 3 Source Code Link:- ACM ICPC Team (github.com) def acmTeam(topic): ans = [] for i in range(n): for j in range(i+1, n): know=0 for a,b in zip(topic[i], topic[j]): if a=='1' or b=='1': know+=1 ans.append(know) return [max(ans), ans.count(max(ans))] Explanation Firstly, we will declare an empty list called ans, Later on we will store…

Acm Icpc Team

2 min read

ACM ICPC Team : HackerRank Solution in Python
ACM ICPC Team : HackerRank Solution in Python
Acm Icpc Team

2 min read


Dec 16, 2020

Number Line Jumps : HackerRank Solution in Python 3

Solution in Python 3 Link:- Knag (github.com) def kangaroo(x1, v1, x2, v2): if x1 < x2 and v1 < v2: return 'NO' else: if v1!=v2 and (x2-x1)%(v2-v1)==0: return 'YES' else: return 'NO' Explanation in Python 3 First, We check whether x1 is less than x2 and v1 is less than v2. If the condition is True then it…

Hackerrank

2 min read

Number Line Jumps : HackerRank solution in Python 3
Number Line Jumps : HackerRank solution in Python 3
Hackerrank

2 min read


Dec 12, 2020

The Minion Game : HackerRank Solution in Python

Kevin and Stuart want to play the ‘The Minion Game’. Game Rules Both players are given the same string, S. Both players have to make substrings using the letters of the string S. Stuart has to make words starting with consonants. Kevin has to make words starting with vowels. The game ends when both…

The Minion Game

2 min read

The Minion Game : HackerRank Solution in Python
The Minion Game : HackerRank Solution in Python
The Minion Game

2 min read

Shounak Lohokare

Shounak Lohokare

16 Followers

pretending to teach is one of the best way to learn.

Following
  • Prasanna Brabourame

    Prasanna Brabourame

  • Rahul Pathak

    Rahul Pathak

  • Pete Buttigieg

    Pete Buttigieg

  • Jeff Bezos

    Jeff Bezos

  • Hoshing_yash

    Hoshing_yash

See all (6)

Help

Status

Writers

Blog

Careers

Privacy

Terms

About

Text to speech

Teams