Frans Bergman 2 jaren geleden
bovenliggende
commit
83ffce7a59
2 gewijzigde bestanden met toevoegingen van 16 en 0 verwijderingen
  1. 0 0
      6.input
  2. 16 0
      6.rb

File diff suppressed because it is too large
+ 0 - 0
6.input


+ 16 - 0
6.rb

@@ -0,0 +1,16 @@
+require 'set'
+
+@input = File.read("6.input").split("\n")
+
+def part(window_size)
+  @input[0].chars.each_with_index do |c, i|
+    chunk = @input[0].chars[(i..i+(window_size-1))]
+    if Set.new(chunk).length == window_size then
+      puts i + window_size
+      break
+    end
+  end
+end
+
+part(4)
+part(14)

Some files were not shown because too many files changed in this diff