# Basic usage with numeric codes
apply_operations(1:5, c("1", "3"), k = 3)
# TopSpin puzzle example
start_state <- 1:20
operations <- c("1", "3", "2") # Left, Reverse(4), Right
result <- apply_operations(start_state, operations, k = 4)
print(result)
# Using letter codes
apply_operations(1:5, c("L", "X", "R"), k = 3)
Run the code above in your browser using DataLab