From cc6ad678f496a4e1dae82a4d30acdf14aa5e21a1 Mon Sep 17 00:00:00 2001 From: Aryaman Garg <166644611+aryaman0406@users.noreply.github.com> Date: Thu, 30 Oct 2025 17:06:33 +0530 Subject: [PATCH 1/5] Add SQL query for rising temperature comparison --- 197. Rising Temperature | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 197. Rising Temperature diff --git a/197. Rising Temperature b/197. Rising Temperature new file mode 100644 index 0000000..c28f849 --- /dev/null +++ b/197. Rising Temperature @@ -0,0 +1,7 @@ +SELECT today.id +FROM Weather yesterday +CROSS JOIN Weather today + +WHERE DATEDIFF(today.recordDate,yesterday.recordDate) = 1 + AND today.temperature > yesterday.temperature +; From d721dba9e38169d6a05b6fe8519e83cc2b579a86 Mon Sep 17 00:00:00 2001 From: Aryaman Garg <166644611+aryaman0406@users.noreply.github.com> Date: Thu, 30 Oct 2025 17:54:31 +0530 Subject: [PATCH 2/5] Create 192. Word Frequency --- 192. Word Frequency | 1 + 1 file changed, 1 insertion(+) create mode 100644 192. Word Frequency diff --git a/192. Word Frequency b/192. Word Frequency new file mode 100644 index 0000000..603c653 --- /dev/null +++ b/192. Word Frequency @@ -0,0 +1 @@ +tr -s ' ' '\n' < words.txt | sort | uniq -c | sort -nr | awk '{print $2, $1}' From 9f0137284d4cc716801e16b08b7d087d46169499 Mon Sep 17 00:00:00 2001 From: Aryaman Garg <166644611+aryaman0406@users.noreply.github.com> Date: Thu, 30 Oct 2025 17:57:24 +0530 Subject: [PATCH 3/5] Create FooBar class for alternating output Implement FooBar class to alternate printing 'foo' and 'bar'. --- Print FooBar Alternately | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 Print FooBar Alternately diff --git a/Print FooBar Alternately b/Print FooBar Alternately new file mode 100644 index 0000000..af087fd --- /dev/null +++ b/Print FooBar Alternately @@ -0,0 +1,30 @@ +class FooBar { +private: + int n; + mutex m1,m2; +public: + FooBar(int n) { + m2.lock(); + this->n = n; + } + + void foo(function printFoo) { + + for (int i = 0; i < n; i++) { + m1.lock(); + // printFoo() outputs "foo". Do not change or remove this line. + printFoo(); + m2.unlock(); + } + } + + void bar(function printBar) { + + for (int i = 0; i < n; i++) { + m2.lock(); + // printBar() outputs "bar". Do not change or remove this line. + printBar(); + m1.unlock(); + } + } +}; From ddb5ac939df53b4ac06fc352c311f5e197f97b9d Mon Sep 17 00:00:00 2001 From: Aryaman Garg <166644611+aryaman0406@users.noreply.github.com> Date: Thu, 30 Oct 2025 18:00:26 +0530 Subject: [PATCH 4/5] Add function to order and rank scores Implement a function to rank scores in a DataFrame. --- Rank Scores | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 Rank Scores diff --git a/Rank Scores b/Rank Scores new file mode 100644 index 0000000..cc20088 --- /dev/null +++ b/Rank Scores @@ -0,0 +1,19 @@ +import pandas as pd + +def order_scores(scores: pd.DataFrame) -> pd.DataFrame: + occr_dict = Counter(scores["score"]) + + intr_arr = [] + for key, freq in occr_dict.items(): + intr_arr.append([key, freq]) + + intr_arr.sort(reverse = True) + + ans = [] + + for i, e in enumerate(intr_arr): + + for j in range(e[1]): + ans.append([e[0], i + 1]) + + return pd.DataFrame(ans, columns=["score", "rank"]) From c819e0e94d8b1626ce3f9b75397b16dead94c4be Mon Sep 17 00:00:00 2001 From: Aryaman Garg <166644611+aryaman0406@users.noreply.github.com> Date: Thu, 30 Oct 2025 18:02:47 +0530 Subject: [PATCH 5/5] Add SQL query to find customers without a referee --- Find Customer Referee | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 Find Customer Referee diff --git a/Find Customer Referee b/Find Customer Referee new file mode 100644 index 0000000..0739cc0 --- /dev/null +++ b/Find Customer Referee @@ -0,0 +1,3 @@ +SELECT name +FROM Customer +WHERE referee_id IS NULL OR referee_id != 2;