Category : for-loop

I’m onto a leetcode problem (Floyd’s Cycle Detection Algorithm for Linked List) wherein I noticed a strange behavior on the pointer states. When I change the pointer state inside the for loop, the program executes correctly (pointer states move to the right states): ListNode *detectCycle(ListNode *head) { if(!head or !head->next) return nullptr; ListNode *slow, *fast; ..

Read more

I have a few nested loops in my code and in some point, they’re divided by a call to a label like this: for /r %%a in (*.mkv *.mp4 *.avi *.mov) do ( call :innerloop "%%a" "%%~fa" ) goto :eof :innerloop setlocal EnableExtensions EnableDelayedExpansion for /f "delims=" %%l in (‘mkvmerge.exe -i "%~1"’) do ( … ..

Read more