From 2c59c2c11e218f946f4afe98c2bb00b65a6b0ba2 Mon Sep 17 00:00:00 2001 From: Andeo1812 Date: Thu, 7 Apr 2022 00:15:31 +0300 Subject: [PATCH] 3 YES --- README.md | 2 +- module_1/3.cpp | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 7530118..57bc127 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ 2 - 4 - YES -3 - 2 +3 - 2 YES 4 - 3 diff --git a/module_1/3.cpp b/module_1/3.cpp index 24c0da4..b604491 100644 --- a/module_1/3.cpp +++ b/module_1/3.cpp @@ -100,9 +100,7 @@ void Deque::PushBack(int data) { Resize(); } - ++last; - - last = (last) % capacity; + last = (last + 1) % capacity; array[last] = data; @@ -138,9 +136,7 @@ int Deque::PopBack() { array[last] = 0; - --last; - - last = (last) % capacity; + last = (last - 1) % capacity; return res; }