
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
AmitDiwan has Published 10744 Articles

AmitDiwan
4K+ Views
To combine, use GROUP_CONCAT() function to combine some attributes in two rows into one. As a separator, use hyphens.Let us first create a table −mysql> create table DemoTable1386 -> ( -> Title varchar(255), -> Name varchar(60) -> ); Query OK, 0 rows affected (0.67 sec)Insert some ... Read More

AmitDiwan
341 Views
To find the closest pair from two sorted array, the Java code is as follows −Example Live Demopublic class Demo { void closest_pair(int my_arr_1[], int my_arr_2[], int arr_1_len, int arr_2_len, int sum){ int diff = Integer.MAX_VALUE; int result_l = 0, result_r = 0; ... Read More

AmitDiwan
539 Views
Let us first create a table −mysql> create table DemoTable1627 -> ( -> FirstName varchar(20), -> LastName varchar(20) -> ); Query OK, 0 rows affected (0.59 sec)Insert some records in the table using insert command.mysql> insert into DemoTable1627 values('John', 'Smith'); Query OK, ... Read More

AmitDiwan
234 Views
To find reminder of array multiplication divided by n, the Java code is as follows −Example Live Demoimport java.util.*; import java.lang.*; public class Demo{ public static int remainder(int my_arr[], int arr_len, int val){ int mul_val = 1; for (int i = 0; i < ... Read More

AmitDiwan
337 Views
To expand a String if range is given, the Java code is as follows −Example Live Demopublic class Demo { public static void expand_range(String word) { StringBuilder my_sb = new StringBuilder(); String[] str_arr = word.split(", "); for (int i = 0; ... Read More

AmitDiwan
826 Views
To count trailing zeroes in factorial of a number, the Java code is as follows −Example Live Demoimport java.io.*; public class Demo{ static int trailing_zero(int num){ int count = 0; for (int i = 5; num / i >= 1; i *= 5){ ... Read More

AmitDiwan
506 Views
To count the characters in each word in a given sentence, the Java code is as follows −Example Live Demoimport java.util.*; public class Demo{ static final int max_chars = 256; static void char_occurence(String my_str){ int count[] = new int[max_chars]; int str_len = my_str.length(); ... Read More

AmitDiwan
138 Views
To convert Iterator to Spliterator, the Java code is as follows −Example Live Demoimport java.util.*; public class Demo{ public static Spliterator getspiliter(Iterator iterator){ return Spliterators.spliteratorUnknownSize(iterator, 0); } public static void main(String[] args){ Iterator my_iter = Arrays.asList(56, 78, 99, 32, 100, 234).iterator(); ... Read More

AmitDiwan
232 Views
To check whether it is possible to make a divisible by 3 number using all digits in an array, the Java code is as follows −Example Live Demoimport java.io.*; import java.util.*; public class Demo{ public static boolean division_possible(int my_arr[], int n_val){ int rem = 0; ... Read More

AmitDiwan
211 Views
To check if the count of divisors is even or odd, the Java code is as follows −Example Live Demoimport java.io.*; import java.math.*; public class Demo{ static void divisor_count(int n_val){ int root_val = (int)(Math.sqrt(n_val)); if (root_val * root_val == n_val){ ... Read More