Opening your workspace…
Workspace/Coding room
Opening your workspace…
At the royal fitting, the guests line up to try on the glass slipper Cinderella left behind. You have the length inside the slipper and the foot lengths of the guests in line. For this fitting, a guest can wear the slipper if their foot is no longer than the slipper. Return the zero-based index of the first guest who can wear it, or -1 if nobody can.
24, [25,24,23]Output1The first guest’s foot is too long. The slipper fits the guest at index 1.
22, [23,24,25]Output-1Every guest’s foot is longer than the slipper.
Check the feet in their original order.
function solve(slipperLength, footLengths) { // Write your solution here. }
Tab inserts two spaces. Shift+Tab outdents. Use the arrow keys and Tab to choose a suggestion. Press Escape, then Tab, to leave the editor. Press Control or Command with apostrophe to run samples or with Enter to submit.