LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Match Pattern misbehaving

I'm working on Advent of Code 2022, day 6.

 

I have a solution for part 2, that works on small example data, but fails on the full data set.

 

I have a text file of 4096 bytes, as a single string. (one \n at the end).

 

I'm searching for the first "offset past match" where a match is 14 unique characters (no repeats).

When I pattern match "lnccdbbhvbvgvm" with "l", from offset 1, I get -1, as expected (no match found)

When I pattern match with "n" starting at offset 2, I get -1, as expected.

When I pattern match "c", starting at offset 2, I also get -1 but I should get 1.

Incidentally, this 14 character string (which should fail the "all chars unique" test) starts at about 49 in the file position, which gives an offest past of 63, a nice round 2^6 - 1. 

Download All
0 Kudos
Message 1 of 2
(839 Views)

You should get "3", not "1"; which is what I get when I run this:

paul_cardinale_0-1670336186982.png

I looked at your code.  But it's messy.  So I stopped looking at it.

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 2 of 2
(821 Views)