A shop window display spells out banners with physical letter tiles. You have the tiles in tiles, one character per tile, and each tile can be used once.
Write canBuildBanner(banner, tiles) that returns true if every letter of banner can be covered by its own tile. Spaces in banner need no tile.
Input: banner = "big sale", tiles = "selagibx" Output: true
Every letter of big sale has a tile, and the extra x is fine.
Input: banner = "hello", tiles = "helo" Output: false
hello needs two l tiles but there is only one.
0 <= banner.length, tiles.length <= 10^5banner has lowercase letters and spaces; tiles has lowercase letters.Run tries your code on the examples. Submit runs every test, including hidden edge cases, and solves the problem when they all pass.
Ctrl + Enter runs, Ctrl + Shift + Enter submits (⌘ on a Mac).
I'm here to help with #17 Letter Tiles for a Banner. I give hints, never the solution, so you get to solve it yourself. Ask for a hint, select code to ask about it, or press Ask Tuto why on a failing test.
Your first 3 answers need no account. for free to keep asking.