gdsc-uba / hactoberfest2022

A repository for 2022 contributions to hacktoberfest by GDSC UBa
GNU General Public License v3.0
61 stars 355 forks source link

Create stringsegmentation.py #808

Open Praveenchouhan3462 opened 1 year ago

Praveenchouhan3462 commented 1 year ago

def can_segment_string(s, dictionary): for i in range(1, len(s) + 1): first = s[0:i] if first in dictionary: second = s[i:] if not second or second in dictionary or can_segment_string(second, dictionary): return True return False

s = "hellonow"; dictionary= set(["hello","hell","on","now"]) if can_segment_string(s, dictionary): print("String Can be Segmented") else: print("String Can NOT be Segmented")

quine-bot[bot] commented 1 year ago

👋 Figuring out if a PR is useful is hard, hopefully this will help.

  • @Praveenchouhan3462 has been on GitHub since 2021 and in that time has had 6 public PRs merged
  • They haven't contributed to this repo before
  • From looking at their profile, they seem to be good with JavaScript and CSS.

Their most recently public accepted PR is: https://github.com/Praveenchouhan3462/Hactoberfest2022/pull/1