Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.

book
Determine the Starting Integer

Given an array of operations ++x, x++, --x. x-- and an integer target, return an initial integer, so that the final value is the target value.

Example 1

Input:

["x++", "--x", "--x"], 12

Output:

13
main.cpp

main.cpp

C++

Spør AI

expand

Spør AI

ChatGPT

Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår

some-alt