Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit314144f

Browse files
Update CircularQueue.js for zero-length case (#1655)
* Update CircularQueue.js* Update CircularQueue.jsTaking comments into account for refactoring my change.* Update CircularQueue.jsAdding "this" to checkEmpty()
1 parentd920e7f commit314144f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

‎Data-Structures/Queue/CircularQueue.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class CircularQueue {
7777

7878
// Displays the length of queue
7979
length(){
80-
returnthis.queue.length-1
80+
returnthis.checkEmpty() ?0 :this.queue.length-1
8181
}
8282

8383
// Display the top most value of queue

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp