Unity3d Code sample to Unreal Blueprint

Hello comunity! This is memory game with cards.
I need translate Unity3d code to unreal blueprint…I was made first part of code in unreal…but with second part i got problem…Could u help me build blueprint for PlaceTheTiles function?

I was made this logic…but its not the same as shown in code…and its works only for 2 lines course of i use FlipFlope instead using of ColumnCount variable.
Iam still looking for your help.

https://i.imgur.com/BQD0xMn.png