
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
Found 33676 Articles for Programming

179 Views
Suppose we have three numbers n, k and t. Amal is analyzing Mexican waves. There are n spectators numbered from 1 to n. They start from time 0. At time 1, first spectator stands, at time 2, second spectator stands. At time k, kth spectator stands then at time (k+1) the (k+1) th spectator stands and first spectator sits, at (k+2), the (k+2)th spectator stands but 2nd one sits, now at nth time, nth spectator stands and (n-k)th spectator sits. At time (n+1), the (n+1-k)th spectator sits and so on. We have to find the number of spectators stands at ... Read More

212 Views
Suppose we have a number n. Amal gives some stones to Bimal and he gives stones more than once, but in one move if Amal gives k stones, in the next move he cannot give k stones, so given stones in one move must be different than the previous move. We have to count the number of times Amal can give stones to Bimal.So, if the input is like n = 4, then the output will be 3, because 1 stone then 2 stones then again 1 stones.StepsTo solve this, we will follow these steps −return (n * 2 + ... Read More

110 Views
Suppose we have four numbers d, L, v1 and v2. Two presses are initially at location 0 and L, they are moving towards each other with speed v1 and v2 each. The width of a person is d, he dies if the gap between two presses is less than d. We have to find how long the person will stay alive.So, if the input is like d = 1; L = 9; v1 = 1; v2 = 2;, then the output will be 2.6667StepsTo solve this, we will follow these steps −e := (L - d)/(v1 + v2) return eExampleLet ... Read More

418 Views
Suppose we have one binary string S with n bits and another number d. On a number line, a frog wants to reach point n, starting from the point 1. The frog can jump to the right at a distance not more than d. For each point from 1 to n if there is a lily flower it is marked as 1, and 0 if not. The frog can jump only in points with a lilies. We have to find the minimal number of jumps that the frog needs to reach n. If not possible, return -1.So, if the input ... Read More

406 Views
Suppose we have an array A with n elements. There were n groups of students. A group is either one person who can write the code with anyone else, or two people who want to write the code in the same team. But the mentor decided to form teams of exactly three people. We have to find the maximum number of teams of three people the mentor can form. For groups of two, either both students should write the code, or both should not. If two students from a group of two will write the code, they should be in ... Read More

3K+ Views
In this article, we will learn how to convert the local time to GMT (Greenwich Mean Time) in Java. We need this conversion when we want to standardize time across different time zones or when working with systems that require GMT. We will cover the following methods to convert local time to GMT: Using ZonedDateTime class Using Calendar Class Using Date Class Using ZonedDateTime Class ZonedDateTime class was introduced in Java 8, which is used for converting local time to GMT. We can use the ... Read More

689 Views
In this article, we will learn how to display the current date in different country formats using Java. We can import java.time package to work with the date and time API. The java.time package, along with the DateFormat and Locale classes, allows us to format the date according to various regions' standards. Displaying Date in Different Country Formats There are two or more ways to display the date in different country formats in Java: Using DateFormat Class Using LocalDate Class and DateTimeFormatter Let's explore each of these methods in detail. Using ... Read More

412 Views
In this article, we will understand how to display dates of a calendar year in different formats. Java has a built-in Date class, but it is recommended to use the java.time package, to work with the modern date and time API. The package includes many date and time classes. Following are the ways to display dates of a calendar year in different formats: Using DateFormat Class Using SimpleDateFormat Class Using LocalDate Class and DateTimeFormatter Using DateFormat Class The DateFormat class is part of the java.text package. ... Read More

3K+ Views
The ArrayList class is a resizable array that can be found in java.util package. The difference between a built-in array and an ArrayList in Java is that the size of an array cannot be modified. Lambda Expression is a feature that was introduced in Java 8. It is useful when we use collections, such as ArrayList, Set, or Map, and we want to perform operations on the elements of these collections. In this article, we will learn how to iterate over an ArrayList using a lambda expression in Java. Iterating Over an ArrayList Using Lambda Expressions There are two main ... Read More

4K+ Views
The ArrayList is a resizable array, which is part of java.util package. The difference between a built-in array and an ArrayList in Java is that the size of an array cannot be modified. In this article, we will understand how to pass an ArrayList as a function argument. Following are the ways to pass an ArrayList as a function argument: Using Function Argument Using Return Type Using Function Argument We can pass an ArrayList as a function argument in Java. The function can take an ArrayList as a parameter and perform operations ... Read More