Queue Is Empty
Published at25 Jul 2026
Created by M Ichsanul Fadhil
Check if a queue (represented as an array) is empty. Return true if the array has no elements, false otherwise.
Example Input & Output
Example 1
Input
[0]
Output
false
Explanation
Zero is still an element
Example 2
Input
[]
Output
true
Explanation
Empty again
Example 3
Input
[1,2,3]
Output
false
Explanation
Has elements
Example 4
Input
[1]
Output
false
Explanation
Has one element
Example 5
Input
[]
Output
true
Explanation
Empty queue
Algorithm Flow

Recommendation Algorithm Flow for Queue Is Empty
Solution Approach
Best Answers
java
class Solution {
public boolean solution(int[] nums) {
return nums.length==0;
}
}Comments (0)
Join the Discussion
Share your thoughts, ask questions, or help others with this Challenge.
