<commit_before>package org.hackerrank.java.datastructure;

import java.util.Scanner;

public class Array1DPart2
{
	public static void main(String[] args)
	{
		Scanner scanner = new Scanner(System.in);
		
		int[][] sequences = new int[scanner.nextInt()][];
		int[] jumps = new int[sequences.length];
		
		for(int i = 0; i < sequences.length; i++)
		{
			sequences[i] = new int[scanner.nextInt()];
			jumps[i] = scanner.nextInt();
			
			for(int j = 0; j < sequences[i].length; j++)
			{
				sequences[i][j] = scanner.nextInt();
			}
		}
		
		scanner.close();
		
		for(int i = 0; i < sequences.length; i++)
		{
			int currentIndex = 0;
			int currentStart = 0;
			boolean solveable = false;
			
			while(!solveable)
			{
				if(sequences[i][currentIndex + jumps[i]] == 0)
				{
					currentIndex += jumps[i];
					
				}
			}
		}
    }
}<commit_msg>Getting closer to solving Part 2<commit_after>package org.hackerrank.java.datastructure;

import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Array1DPart2
{
	public static void main(String[] args)
	{
		Scanner scanner = new Scanner(System.in);
		
		int[][] sequences = new int[scanner.nextInt()][];
		int[] jumps = new int[sequences.length];
		
		for(int i = 0; i < sequences.length; i++)
		{
			sequences[i] = new int[scanner.nextInt()];
			jumps[i] = scanner.nextInt();
			
			for(int j = 0; j < sequences[i].length; j++)
			{
				sequences[i][j] = scanner.nextInt();
			}
		}
		
		scanner.close();
		
		Pattern zeroPattern = Pattern.compile("0+");
		
		for(int i = 0; i < sequences.length; i++)
		{
			StringBuilder sequenceBuilder = new StringBuilder();
			
			for(int j = 0; j < sequences[i].length; j++)
			{
				sequenceBuilder.append(sequences[i][j]);
			}
			
			String sequence = sequenceBuilder.toString();
			
			Matcher zeroMatcher = zeroPattern.matcher(sequence);
			
			int currentIndex = 0;
			
			while(zeroMatcher.find(currentIndex))
			{
				for(currentIndex = zeroMatcher.end() - 1; !IndexBlocked(sequence, currentIndex) && !IndexBlocked(sequence, currentIndex + jumps[i]); currentIndex--);
				
				if(IndexBlocked(sequence, currentIndex))
				{
					break;
				}
				
				else
				{
					currentIndex += jumps[i];
				}
				
				if(currentIndex >= sequence.length()) 
				{
					break;
				}
			}
			
			System.out.println(currentIndex >= sequence.length() ? "YES" : "NO");
		}
    }
	
	static boolean IndexBlocked(String sequence, int index)
	{
		if(index < 0)
		{
			return true;
		}
		
		else if(index >= sequence.length())
		{
			return false;
		}
		
		else if(sequence.charAt(index) == 1)
		{
			return true;
		}
		
		else
		{
			return false;
		}
	}
}
{'fraction_non_alphanumeric': 0.15048543689320387, 'fraction_numerical': 0.0074682598954443615, 'mean_word_length': 2.854676258992806, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3225609', 'n_tokens_mistral': 1188, 'n_tokens_neox': 908, 'n_words': 193}