← Blog Home

Snack Break Problems #15 & #16

Hello! This week we have two Snack Break challenges.

Problem #15

ROBLOX games are organized in a hierarchy. The game contains Workspace, Players, etc. Then, Workspace could contain Parts, and Parts could contain Decals, etc.

The challenge is to craft a script that can identify the "deepest" object in any game. That is, the object that has the most parents or ancestors.


Problem #16

Phone dial pads usually have letters on them, as you can see in the following image:

Dial pad

Many modern smartphones have a feature that allows you to type a contact's name with only these numbers, and the phone will use a smart fuzzy searching algorithm to find which contact you are meaning to type.

For example, to type "Anna", you would enter the numbers "2662". To type "Mom", you would search "666". To type "Harold", you would enter "427653".

The challenge is to create an algorithm which, given a list of names, can sort through and return a list of names which matches the user-entered number string, prioritizing matches which start from the beginning (e.g. "25" would sort "Alex" above "Sally", even though they both contain the sequence "al" which would match "25").

For reference, here is a list of letters which go with which number on the dial pad:

  • 2 A B C
  • 3 D E F
  • 4 G H I
  • 5 J K L
  • 6 M N O
  • 7 P Q R S
  • 8 T U V
  • 9 W X Y Z

For convenience, I have compiled a list of map of the letters in Lua table format, and a list of example contact names, also in Lua table format.


If you would like to get a shout-out in next week's Snack Break post, then please post a link to a place with a working demo of Problem #16 in the comments section below.

Good luck!


Leave a Comment

buoyantair says: May 13, 2016
I think we could simply use FindFirstChild(object, true) to get the deepest value :D
Vaeb says: May 13, 2016
Completed. Here's #16: https://www.roblox.com/games/413530521/16
Pyrondon says: May 15, 2016
Where would I send #15?