From 0292c29851d1e9e02db013e18ec9f581b0dea9b2 Mon Sep 17 00:00:00 2001 From: chayan das Date: Wed, 24 Sep 2025 20:21:56 +0530 Subject: [PATCH] Create 166. Fraction to Recurring Decimal 1 --- 166. Fraction to Recurring Decimal 1 | 62 ++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 166. Fraction to Recurring Decimal 1 diff --git a/166. Fraction to Recurring Decimal 1 b/166. Fraction to Recurring Decimal 1 new file mode 100644 index 0000000..1e127e5 --- /dev/null +++ b/166. Fraction to Recurring Decimal 1 @@ -0,0 +1,62 @@ +class SpecialQueue { + + public: + + queueq; + dequedq1,dq2; + + // dq1-> mini + // dq2-> maxi + void enqueue(int x) { + // Insert element into the queue + q.push(x); + + while(!dq1.empty() && dq1.back()>x){ + dq1.pop_back(); + } + + dq1.push_back(x); + + while(!dq2.empty() && dq2.back()