Given an array of N integers, the task is to find a non-empty subset such that the sum of elements of the subset is divisible… Read More
Tag Archives: Arrays
Given an array of N elements. The task is to print the maximum number by concatenating every element in each rotation. In every rotation, the… Read More
Given a rod of length L, the task is to cut the rod in such a way that the total number of segments of length… Read More
Given start, end and an array of N numbers. At each step, start is multiplied with any number in the array and then mod operation… Read More
Given a 2D array of size M x N. Calculate count of positions in 2D array where address as per row-major order equals to address… Read More
Given a string, find the longest substring which is a palindrome. For example, if the given string is “forgeeksskeegfor”, the output should be “geeksskeeg”. Prerequisite… Read More
#include <stdio.h> int main() { char p; char buf[10] = {1, 2, 3, 4, 5, 6, 9, 8}; p = (buf + 1)[5]; printf("%d\n", p);… Read More
#include<stdio.h> int main() { int a[10][20][30] = {0}; a[5][2][1] = 2; return 0; } Which of the following will print the value 2 for the… Read More
class Test { public static void main (String[] args) { int arr1[] = {1, 2, 3}; int arr2[] = {1, 2, 3}; if (arr1.equals(arr2)) System.out.println("Same");… Read More
Output of following Java program? import java.util.Arrays; class Test { public static void main (String[] args) { int arr1[] = {1, 2, 3}; int arr2[]… Read More
Output of following Java program? class Test { public static void main (String[] args) { int arr1[] = {1, 2, 3}; int arr2[] = {1,… Read More
public class Main { public static void main(String args[]) { int arr[][] = new int[4][]; arr[0] = new int[1]; arr[1] = new int[2]; arr[2] =… Read More
class Test { public static void main(String args[]) { int arr[] = new int[2]; System.out.println(arr[0]); System.out.println(arr[1]); } } (A) 0 0 (B) garbage value garbage… Read More
class Test { public static void main(String args[]) { int arr[2]; System.out.println(arr[0]); System.out.println(arr[1]); } } (A) 0 0 (B) garbage value garbage value (C) Compiler… Read More
Predict the output? // file name: Main.java public class Main { public static void main(String args[]) { int arr[] = {10, 20, 30, 40, 50};… Read More