Java | JSP | JSF Answers

Questions: 4 418

Answers by our Experts: 3 943

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

Given the following code, what is the value of ticTacToe[2][1]


String row1[] = {" ","X","O"};

String row2[] = {"X"," ","O"};

String row3[] = {"O","X"," "};

String ticTacToe[][] = {row1,row2,row3};


The function accepts two positive integers ‘r’ and ‘unit’ and a positive integer array ‘arr’ of size ‘n’ as its argument ‘r’ represents the number of rats present in an area, ‘unit’ is the amount of food each rat consumes and each ith element of array ‘arr’ represents the amount of food present in ‘i+1’ house number, where 0 <= i

Implement a standalone product search program in Java, using Hibernate that lists matching products for a user who is looking for T-shirts.


You are given 3 CSV files, each containing the T-shirts data for Nike, Puma and Adidas respectively. Use the same CSV files as provided in Assignment 1. You can add more data in existing files or can add more CSV files for another companies. The data from these files needs to be persisted in the database. All the search operations for the flights will be done on the database using hibernate.



Write a program that accepts numeric command line arguments and adds all of

them. For example, if the argument list is: 100 100 134 150 300 200

The output should be: 984


Create an abstract class called figure which has an abstract method called draw().

Make the subclasses called Filled_Rectangle, Filled_Arc and override the draw()

function in which you would just print the message regarding the current object.




An array of 5 string is given where each string contains 2 characters, Now you have to sort these strings using insertion sort, like in a dictionary.


Input


Input contains 5 strings of length 2 separated by spaces.


String contains only uppercase English letters.


Output


Print the sorted array.



You are given an integer array A of size N. For each index i (1 <= i <= N), you need to find an index j, such that gcd(A[i], A[j]) = 1, and abs(i-j) is the minimum possible. If there are two values of j satisfying the condition, report the minimum one. If there is no possible value of j, report -1.






Note: gcd(x, y) represents the the greatest common divisor of integers x and y, while abs(i- j) represents the absolute value of (i-j). Eg: gcd(6, 15) = 3 ; abs(6-15) = 9.




See sample for better understanding.




Input




The first line of the input contains a single integer N.




The next line of the input contains N space separated integers, the elements of the array A.





Constraints




1 <= N <= 200000




1 <= A[i] <= 50




Output- Output N space separated integers, the value of j corresponding to each index. If there is no possible value of j, report -1 instead.

back


GCD - Post Class - GCD of LCM! (Contest)by Akash Srivastava


Run


Save and Run Hidden Test Cases


GCD of LCM! (Contest)



standard input/output: 2s/128000 kB



You are given an array A consisting of N number and an empty set S. For each pair of numbers A[i] and A[j] in the array (i < j), you need to find their LCM and insert the LCM into the set S.



You need to report the GCD of the elements in set S.


Input


The first line of the input contains an integer N.


The second line of the input contains N space separated integers A[1], A[2],. , A[N].



Constraints


2 <= N <= 100000


1 <= A[i] <= 200000


Output


Output a single integer, the GCD of LCM set S.

Given a linked list, the task is to move all 0’s to the front of the linked list. The order of all another element except 0 should be same after rearrangement.




Note: Avoid use of any type of Java Collection frameworks.




Note: For custom input/output, enter the list in reverse order, and the output will also be in reverse order.



Input



User Task:



Since this will be a functional problem, you don't have to take input. You just have to complete the function moveZeroes() that takes head node as parameter.




Constraints:



1 <= T <= 100



1 <= N <= 100000



0<=Node.data<=100000




Note:- Sum of all test cases doesn't exceed 10^5




Output



Return the head of the modified linked list.




Write a menu driven program to implement linear queue operations using linked list

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS