Angad Sandhu
Search
Browse

846_Hand_of_Straights

Source name
846_Hand_of_Straights.py
# File: Leetcode/Solutions/846_Hand_of_Straights.py

"""
Problem Number: 846
Problem Name: Hand of Straights
Difficulty: Medium
Tags: Hash Table, Greedy, Sorting, Neetcode 150
Company (Frequency): Amazon, Google, Facebook, Microsoft, Apple
Leetcode Link: <https://leetcode.com/problems/hand-of-straights/description/>

DESCRIPTION

Check if hand of cards can be rearranged into groups of consecutive numbers of size W.
Approaches:

* Count frequencies in OrderedMap/Counter, greedily create groups starting from smallest.
* O(n log n) time with sorting or ordered structure.
"""

Browse the library