Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
I needed to add:
#include <algorithm>
to get this to compile.
I used the following compilation command:
g++ --std=c++17 -o a.out a.cpp
on ChromeOS virtualized Linux environment:
penguin 5.15.117-19679-g172023e664f7
This comment is hidden because it contains spoiler information about the solution
That's how tic-tac-toe works in 2-D.
%%
is one of many Parameter Substitution Operators in BASH.Source: https://tldp.org/LDP/abs/html/parameter-substitution.html
For context, here are my own practical descriptions of
%%
,%
,##
, and#
. I actually use these at the command line pretty often. Check out the source for definitive descriptions, as well as numerous examples.${a%%b*}
Remove the end of$a
, from right to left, ending on the leftmost pattern that starts with"b"
${a%b*}
Remove the end of$a
, from right to left, ending on the rightmost pattern that starts with"b"
${a##*b}
Remove the beginning of$a
, from left to right, ending on the rightmost pattern that ends in"b"
${a#*b}
Remove the beginning of$a
, from left to right, ending on the leftmost pattern that ends in"b"
Tips for remembering:
On a standard US keyboard,
#
is to the left of%
. Equivalently,%
is to the right of#
. This should help you remember which key to use.One
#
or%
means non-greedy, whereas two means greedy. Two is more than one, which should help you remember##
and%%
are greedy matches.This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution