The TransCompilator

Solved LeetCode program · 787 of 1,000

#1023 · Camelcase Matching

Medium Array chunk-16.md

Original English source

Keep a shared current as empty text. Keep a shared raised as empty text. Keep a shared capitals as empty text. Place "ABCDEFGHIJKLMNOPQRSTUVWXYZ" into capitals. The pattern is "FB". The queries is a list of "FooBar", "FooBarTest", "FootBall", "FrameBuffer", and "ForceFeedBack". The flags is an empty list of whole numbers.

To raise. Set raised to empty text.
For every spot from 0 to the last position of current.
The symbol is the slice of current from spot to spot plus 1. If capitals contains symbol, Place symbol into raised.

For each query in queries.
Set current to query. Raise. If raised is pattern, Place 1 into flags, otherwise Place 0 into flags.

For each flag in flags.
If flag is 1, show true, otherwise show false.

Open in Playground Browse all 1,000 problems

Expected stdout

true
false
true
true
false