import java.io.*;
import java.math.*;
import java.security.*;
import java.text.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.function.*;
import java.util.regex.*;
import java.util.stream.*;
import static java.util.stream.Collectors.joining;
import static java.util.stream.Collectors.toList;

class Result {

/*
* Complete the ‘dynamicArray’ function below.
*
* The function is expected to return an INTEGER_ARRAY.
* The function accepts following parameters:
* 1. INTEGER n
* 2. 2D_INTEGER_ARRAY queries
*/

public static List<Integer> dynamicArray(int n, List<List<Integer>> queries) {
// Write your code here

Scanner z= new Scanner(System.in);
int lastAns=0,i,index,size,queryType,x,y;

List<Integer> seq =new ArrayList<Integer>();
List<List<Integer>> seqList = new ArrayList<List<Integer>>();

for(i=0;i<n;i++)
{
seq= new ArrayList<Integer>();
seqList.add(seq);
}
List<Integer> correct…


// Complete the hasCycle function below.

/*
* For your reference:
*
* SinglyLinkedListNode {
* int data;
* SinglyLinkedListNode next;
* }
*
*/
static boolean hasCycle(SinglyLinkedListNode head) {
SinglyLinkedListNode slow,fast;
slow=head;
fast=head;
while(slow !=null && fast!=null && fast.next!=null)
{
slow=slow.next;
fast=fast.next.next;
if(slow==fast)
return true;
}
return false;
}


import java.io.*;
import java.math.*;
import java.security.*;
import java.text.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.regex.*;

public class Solution {

// Complete the matchingStrings function below.
static int[] matchingStrings(String[] strings, String[] queries) {
int n,q=0,i,j;
n=strings.length;
q=queries.length;
int b[]=new int[q];//to store the count of same strings
for(j=0;j<q;j++)
{ b[j]=0;
for(i=0;i<n;i++)
{
if(queries[j].equalsIgnoreCase(strings[i]))
{
b[j]++;
}
}
}

return b;
}

private static final Scanner scanner = new Scanner(System.in);

public static void main(String[] args) throws IOException {
BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(System.getenv(“OUTPUT_PATH”)));

int stringsCount = scanner.nextInt();
scanner.skip(“(\r\n|[\n\r\u2028\u2029\u0085])?”);

String[] strings = new String[stringsCount];

for (int i = 0; i < stringsCount; i++) {…

JHANVI SINGH

An organized, detail-oriented, and conscientious self-starter. Flexible and analytical with an infectious enthusiasm for technology.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store