question_slug stringlengths 3 77 | title stringlengths 1 183 | slug stringlengths 12 45 | summary stringlengths 1 160 ⌀ | author stringlengths 2 30 | certification stringclasses 2
values | created_at stringdate 2013-10-25 17:32:12 2025-04-12 09:38:24 | updated_at stringdate 2013-10-25 17:32:12 2025-04-12 09:38:24 | hit_count int64 0 10.6M | has_video bool 2
classes | content stringlengths 4 576k | upvotes int64 0 11.5k | downvotes int64 0 358 | tags stringlengths 2 193 | comments int64 0 2.56k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
longest-continuous-increasing-subsequence | Easy python method using sliding window approach | easy-python-method-using-sliding-window-9h2s5 | Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time | arun_balakrishnan | NORMAL | 2024-04-16T13:48:17.324480+00:00 | 2024-04-16T13:48:17.324508+00:00 | 126 | false | # Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ --... | 2 | 0 | ['Python3'] | 0 |
longest-continuous-increasing-subsequence | python easy solution. | python-easy-solution-by-alaaelgndy-wru6 | Intuition \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time complexity:\n Add your time complexity here, e.g. O(n) \n\n- | alaaelgndy | NORMAL | 2024-03-17T09:24:15.301944+00:00 | 2024-03-17T09:24:15.301967+00:00 | 381 | false | # Intuition \n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution:\n def findLengthOfLCIS(self, nu... | 2 | 0 | ['Python3'] | 0 |
longest-continuous-increasing-subsequence | 🟢Beats 100.00% of users with Java, Easy Solution with Explanation | beats-10000-of-users-with-java-easy-solu-c5h4 | Keep growing \uD83D\uDE0A\n\n\n\n# Complexity\n\n- Time complexity: O(N)\n\n- Space complexity: O(1)\n\n\n# Explanation\n\nJavascript []\nStart\n Initializatio | rahultripathi17 | NORMAL | 2024-01-14T12:51:37.605297+00:00 | 2024-04-04T09:12:07.922884+00:00 | 602 | false | > ##### Keep growing \uD83D\uDE0A\n\n\n\n# Complexity\n\n- Time complexity: O(N)\n\n- Space complexity: O(1)\n\n\n# Explanation\n\n```Javascript []\nStart\n Initialization: maxLength = 1, currentLength = 1... | 2 | 0 | ['Array', 'Math', 'Java'] | 0 |
longest-continuous-increasing-subsequence | Best C++ Solution | best-c-solution-by-ravikumar50-v7l0 | Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time | ravikumar50 | NORMAL | 2023-11-17T17:53:01.438220+00:00 | 2023-11-17T17:53:01.438251+00:00 | 567 | false | # Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ --... | 2 | 0 | ['C++'] | 1 |
longest-continuous-increasing-subsequence | O(n) Longest Continuous Increasing Subsequence Solution in C++ | on-longest-continuous-increasing-subsequ-b6uf | Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time | The_Kunal_Singh | NORMAL | 2023-05-14T03:20:07.270088+00:00 | 2023-05-14T03:20:07.270122+00:00 | 443 | false | # Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\nO(n)\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$... | 2 | 0 | ['C++'] | 0 |
longest-continuous-increasing-subsequence | Solution | solution-by-deleted_user-xjme | C++ []\nclass Solution {\npublic:\n int findLengthOfLCIS(vector<int>& nums) {\n int maxlength = 1;\n int length = 1;\n int n = nums.size | deleted_user | NORMAL | 2023-04-17T13:17:59.099337+00:00 | 2023-04-17T13:44:03.515514+00:00 | 1,124 | false | ```C++ []\nclass Solution {\npublic:\n int findLengthOfLCIS(vector<int>& nums) {\n int maxlength = 1;\n int length = 1;\n int n = nums.size();\n for(int i= 1; i<n;i++){\n if (nums[i-1]<nums[i]){\n length++;\n }\n else{\n if(ma... | 2 | 0 | ['C++', 'Java', 'Python3'] | 0 |
longest-continuous-increasing-subsequence | simple cpp solution | simple-cpp-solution-by-prithviraj26-9fsl | Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time | prithviraj26 | NORMAL | 2023-02-08T16:00:00.307033+00:00 | 2023-02-08T16:00:00.307088+00:00 | 359 | false | # Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\no(n)\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n... | 2 | 0 | ['Array', 'C++'] | 0 |
longest-continuous-increasing-subsequence | ✅ [Rust] 0 ms, linear scan (with detailed comments) | rust-0-ms-linear-scan-with-detailed-comm-y64f | This solution employs a simple loop to count the number of characters in the longest continuous increasing subsequence. It demonstrated 0 ms runtime (100.00%) a | stanislav-iablokov | NORMAL | 2022-09-13T09:32:53.917656+00:00 | 2022-10-23T12:57:45.006077+00:00 | 148 | false | This [solution](https://leetcode.com/submissions/detail/798332889/) employs a simple loop to count the number of characters in the longest continuous increasing subsequence. It demonstrated **0 ms runtime (100.00%)** and used **2.0 MB memory (100.00%)**. Detailed comments are provided.\n\n**IF YOU LIKE THIS SOLUTION, P... | 2 | 0 | ['Rust'] | 1 |
longest-continuous-increasing-subsequence | Clean 0ms Java Solution | clean-0ms-java-solution-by-nomaanansarii-x6bt | \nclass Solution {\n public int findLengthOfLCIS(int[] nums) \n {\n int max =0;\n int count =0;\n \n for(int i=1; i<nums.lengt | nomaanansarii100 | NORMAL | 2022-09-12T08:03:30.677918+00:00 | 2022-09-12T08:03:30.677951+00:00 | 733 | false | ```\nclass Solution {\n public int findLengthOfLCIS(int[] nums) \n {\n int max =0;\n int count =0;\n \n for(int i=1; i<nums.length;i++)\n {\n if(nums[i-1] < nums[i])\n {\n count++;\n max = Math.max(count , max);\n }\... | 2 | 0 | ['Java'] | 0 |
longest-continuous-increasing-subsequence | O(n) with go | on-with-go-by-tuanbieber-47h6 | \nfunc findLengthOfLCIS(nums []int) int {\n res, current := 1, 1\n \n for i := 1; i < len(nums); i++ {\n if nums[i] > nums[i-1] {\n c | tuanbieber | NORMAL | 2022-08-20T16:18:13.014082+00:00 | 2022-08-20T16:18:13.014128+00:00 | 387 | false | ```\nfunc findLengthOfLCIS(nums []int) int {\n res, current := 1, 1\n \n for i := 1; i < len(nums); i++ {\n if nums[i] > nums[i-1] {\n current++ \n } else {\n if current > res {\n res = current\n }\n \n current = 1\n... | 2 | 0 | ['Go'] | 0 |
longest-continuous-increasing-subsequence | 📌Fastest Java☕ solution 0ms💯 | fastest-java-solution-0ms-by-saurabh_173-szcx | ```\nclass Solution {\n public int findLengthOfLCIS(int[] nums) {\n int len=1,max=0;\n for(int i=1;i<nums.length;i++)\n {\n i | saurabh_173 | NORMAL | 2022-07-04T15:48:26.030704+00:00 | 2022-07-04T15:48:26.030733+00:00 | 274 | false | ```\nclass Solution {\n public int findLengthOfLCIS(int[] nums) {\n int len=1,max=0;\n for(int i=1;i<nums.length;i++)\n {\n if(nums[i-1]<nums[i])\n len++;\n else\n {\n max=Math.max(len,max);\n len=1;\n }\n ... | 2 | 0 | ['Java'] | 0 |
longest-continuous-increasing-subsequence | O(N) solution | on-solution-by-andrewnerdimo-4f6b | \nclass Solution:\n def findLengthOfLCIS(self, nums: List[int]) -> int:\n maxLen = count = 1\n for i in range(len(nums) - 1):\n if n | andrewnerdimo | NORMAL | 2022-05-19T11:48:36.813258+00:00 | 2022-05-19T11:48:36.813289+00:00 | 449 | false | ```\nclass Solution:\n def findLengthOfLCIS(self, nums: List[int]) -> int:\n maxLen = count = 1\n for i in range(len(nums) - 1):\n if nums[i] < nums[i + 1]:\n count += 1\n else:\n count = 1\n \n maxLen = max(count, maxLen)\n ... | 2 | 0 | ['Python', 'Python3'] | 0 |
longest-continuous-increasing-subsequence | Simple and Easy || C++ || | simple-and-easy-c-by-bhaskarv2000-195q | \nclass Solution\n{\npublic:\n int findLengthOfLCIS(vector<int> &nums)\n {\n int mn = INT_MIN, cnt = 0, mx = 0;\n for (auto it : nums)\n | BhaskarV2000 | NORMAL | 2022-04-17T14:34:04.765757+00:00 | 2022-04-17T14:34:04.765789+00:00 | 252 | false | ```\nclass Solution\n{\npublic:\n int findLengthOfLCIS(vector<int> &nums)\n {\n int mn = INT_MIN, cnt = 0, mx = 0;\n for (auto it : nums)\n {\n if (it > mn)\n {\n mn = it;\n cnt++;\n }\n else\n {\n ... | 2 | 0 | ['C'] | 0 |
longest-continuous-increasing-subsequence | Longest Continuous Increasing Subsequence Solution Java | longest-continuous-increasing-subsequenc-7i4o | class Solution {\n public int findLengthOfLCIS(int[] nums) {\n int ans = 0;\n\n for (int l = 0, r = 0; r < nums.length; ++r) {\n if (r > 0 && nums[r | bhupendra786 | NORMAL | 2022-03-25T07:23:33.028008+00:00 | 2022-03-25T07:23:33.028047+00:00 | 100 | false | class Solution {\n public int findLengthOfLCIS(int[] nums) {\n int ans = 0;\n\n for (int l = 0, r = 0; r < nums.length; ++r) {\n if (r > 0 && nums[r] <= nums[r - 1])\n l = r;\n ans = Math.max(ans, r - l + 1);\n }\n\n return ans;\n }\n}\n | 2 | 0 | ['Array'] | 0 |
longest-continuous-increasing-subsequence | Python | Single pass | Simplest Self Explanatory Code | python-single-pass-simplest-self-explana-7tlu | \nclass Solution:\n def findLengthOfLCIS(self, nums: List[int]) -> int:\n lcis, cis = 1, 1\n for i in range(1, len(nums)):\n if nums | akash3anup | NORMAL | 2021-12-13T06:01:47.225236+00:00 | 2021-12-13T06:01:47.225282+00:00 | 123 | false | ```\nclass Solution:\n def findLengthOfLCIS(self, nums: List[int]) -> int:\n lcis, cis = 1, 1\n for i in range(1, len(nums)):\n if nums[i] > nums[i-1]:\n cis += 1\n else:\n cis = 1\n lcis = max(lcis, cis)\n return lcis\n \n```... | 2 | 0 | ['Python'] | 0 |
longest-continuous-increasing-subsequence | C++ || 4ms || simple solution | c-4ms-simple-solution-by-rohit_sapkal-09p0 | class Solution {\npublic:\n\n int findLengthOfLCIS(vector& nums) {\n int n = nums.size();\n int ct = 1, count=0;\n \n for(int i=0 | Rohit_Sapkal | NORMAL | 2021-10-17T14:08:43.548808+00:00 | 2021-10-17T14:08:43.548838+00:00 | 149 | false | class Solution {\npublic:\n\n int findLengthOfLCIS(vector<int>& nums) {\n int n = nums.size();\n int ct = 1, count=0;\n \n for(int i=0 ; i<n-1 ; ++i)\n {\n if(nums[i]>=nums[i+1])\n {\n count = max(count,ct);\n ct=1;\n }... | 2 | 0 | ['C'] | 0 |
longest-continuous-increasing-subsequence | Easy Java Solution | easy-java-solution-by-kritikasinha-6x57 | class Solution {\n\n public int findLengthOfLCIS(int[] nums) {\n int max = 1, count = 1;\n \n for(int i = 1; inums[i-1])\n {\ | kritikasinha_ | NORMAL | 2021-08-13T15:32:00.705534+00:00 | 2021-08-13T15:32:00.705581+00:00 | 233 | false | class Solution {\n\n public int findLengthOfLCIS(int[] nums) {\n int max = 1, count = 1;\n \n for(int i = 1; i<nums.length; i++)\n {\n if(nums[i]>nums[i-1])\n {\n count++;\n max = Math.max(max, count);\n }\n else\n ... | 2 | 0 | ['Java'] | 0 |
longest-continuous-increasing-subsequence | JS-Easy to understand for beginners as well(2 solutions) | js-easy-to-understand-for-beginners-as-w-6s9r | \nvar findLengthOfLCIS = function (nums) {\n let count = 1,\n max = 0;\n for (let i = 1; i < nums.length; i++) {\n if (nums[i] > nums[i - 1]) {\n c | lssuseendharlal | NORMAL | 2021-03-24T13:08:50.201756+00:00 | 2021-04-18T13:27:12.962960+00:00 | 211 | false | ```\nvar findLengthOfLCIS = function (nums) {\n let count = 1,\n max = 0;\n for (let i = 1; i < nums.length; i++) {\n if (nums[i] > nums[i - 1]) {\n count++;\n max = Math.max(max, count);\n } else {\n count = 1;\n }\n }\n return nums.length >= 1 ? (max > 0 ? max : count) : 0;\n};\n\n```\n... | 2 | 0 | ['JavaScript'] | 2 |
longest-continuous-increasing-subsequence | C++ || Greed is best || Easy to understand | c-greed-is-best-easy-to-understand-by-an-a6vv | Runtime: 24 ms, faster than 54.02% of C++ online submissions for Longest Continuous Increasing Subsequence.\nMemory Usage: 11 MB, less than 94.51% of C++ online | anonymous_kumar | NORMAL | 2020-07-31T19:48:50.511504+00:00 | 2020-07-31T19:48:50.511550+00:00 | 420 | false | ***Runtime: 24 ms, faster than 54.02% of C++ online submissions for Longest Continuous Increasing Subsequence.\nMemory Usage: 11 MB, less than 94.51% of C++ online submissions for Longest Continuous Increasing Subsequence.***\n```\nclass Solution {\npublic:\n int findLengthOfLCIS(vector<int>& nums) {\n int n ... | 2 | 0 | ['C', 'C++'] | 0 |
longest-continuous-increasing-subsequence | Simple Java beats 100% | simple-java-beats-100-by-swapnil510-m53l | ```\n public int findLengthOfLCIS(int[] nums) {\n if(nums==null || nums.length ==0)\n return 0;\n int count = 1;\n int max = | swapnil510 | NORMAL | 2019-12-28T21:23:12.343103+00:00 | 2019-12-28T21:23:12.343146+00:00 | 265 | false | ```\n public int findLengthOfLCIS(int[] nums) {\n if(nums==null || nums.length ==0)\n return 0;\n int count = 1;\n int max = 0;\n for(int i =1;i<nums.length;i++){\n if(nums[i]>nums[i-1]){\n count++;\n }else{\n max = Math.max(m... | 2 | 0 | [] | 0 |
longest-continuous-increasing-subsequence | Divide and Conquer Recursive Solution [Accepted] | divide-and-conquer-recursive-solution-ac-0qpd | Below is a classic divide-and-conquer approach to solve this problem using recursion in C#. Although a little complex than the linear solution presented in Solu | ccpu | NORMAL | 2019-07-06T04:16:42.361531+00:00 | 2019-07-06T04:16:42.361565+00:00 | 249 | false | Below is a classic divide-and-conquer approach to solve this problem using recursion in C#. Although a little complex than the linear solution presented in Solution tab, its intuitive and a common approach for "longest subsequence" kind of problems.\n\n```\npublic class Solution {\n int FindLCIS_Iter(int[] a, int st... | 2 | 0 | [] | 0 |
longest-continuous-increasing-subsequence | python easy solution | python-easy-solution-by-zlpmichelle-hrut | \n\n max_res = 0\n count = 0\n for i in range(len(nums)):\n if i == 0 or nums[i] > nums[i - 1]:\n count += 1\n | zlpmichelle | NORMAL | 2019-06-02T20:28:42.286985+00:00 | 2019-06-02T20:29:55.412797+00:00 | 245 | false | \n\n max_res = 0\n count = 0\n for i in range(len(nums)):\n if i == 0 or nums[i] > nums[i - 1]:\n count += 1\n max_res = max(max_res, count)\n else:\n count = 1\n return max_res | 2 | 0 | [] | 0 |
longest-continuous-increasing-subsequence | Python - super simple and very intuitive - also beats 100% at the moment | python-super-simple-and-very-intuitive-a-0o2l | \nclass Solution(object):\n def findLengthOfLCIS(self, nums):\n """\n :type nums: List[int]\n :rtype: int\n """\n if not n | poojanarayan | NORMAL | 2018-08-29T09:27:20.470302+00:00 | 2018-09-07T16:14:43.545668+00:00 | 272 | false | ```\nclass Solution(object):\n def findLengthOfLCIS(self, nums):\n """\n :type nums: List[int]\n :rtype: int\n """\n if not nums:\n return 0\n if len(nums) == 1:\n return 1\n \n count = 1\n maxcount = 1\n \n for i in r... | 2 | 1 | [] | 0 |
longest-continuous-increasing-subsequence | Python, 'Anchor' Approach | python-anchor-approach-by-awice-axta | Let's remember the smallest value prev in our current chain, and the length count of the current chain.\n\n\ndef findLengthOfLCIS(self, nums):\n prev = float | awice | NORMAL | 2017-09-10T04:24:50.134000+00:00 | 2017-09-10T04:24:50.134000+00:00 | 312 | false | Let's remember the smallest value `prev` in our current chain, and the length `count` of the current chain.\n\n```\ndef findLengthOfLCIS(self, nums):\n prev = float('-inf')\n ans = count = 0\n for x in nums:\n if x > prev:\n count += 1\n ans = max(ans, count)\n else:\n ... | 2 | 1 | [] | 1 |
longest-continuous-increasing-subsequence | Python | python-by-ipeq1-2n7y | \nclass Solution(object):\n def findLengthOfLCIS(self, nums):\n if not nums:\n return 0\n ans, pre = 1, 1\n for i in range(1, | ipeq1 | NORMAL | 2017-09-12T04:48:28.022000+00:00 | 2017-09-12T04:48:28.022000+00:00 | 445 | false | ```\nclass Solution(object):\n def findLengthOfLCIS(self, nums):\n if not nums:\n return 0\n ans, pre = 1, 1\n for i in range(1, len(nums)):\n if nums[i] > nums[i - 1]:\n ans = max(ans, i - pre)\n else:\n pre = 1\n ans = m... | 2 | 0 | [] | 2 |
longest-continuous-increasing-subsequence | beats 100% and easy solution in c++. | beats-100-and-easy-solution-in-c-by-xegl-yx6e | IntuitionApproachComplexity
Time complexity:O(n)
Space complexity:O(1)
Code | xegl87zdzE | NORMAL | 2025-04-06T12:10:15.816162+00:00 | 2025-04-06T12:10:15.816162+00:00 | 32 | false | # Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
# Approach
<!-- Describe your approach to solving the problem. -->
# Complexity
- Time complexity:O(n)
<!-- Add your time complexity here, e.g. $$O(n)$$ -->
- Space complexity:O(1)
<!-- Add your space complexity here, e.g. $$O(n)$$ -->
... | 1 | 0 | ['Array', 'C++'] | 0 |
longest-continuous-increasing-subsequence | Longest Continuous Increasing Subsequence | longest-continuous-increasing-subsequenc-mp2x | IntuitionThe problem asks for the length of the longest continuous increasing subsequence (LCIS) in an array.
To solve this, we traverse the array while keeping | expert07 | NORMAL | 2025-03-13T09:12:58.556125+00:00 | 2025-03-13T09:12:58.556125+00:00 | 135 | false | # Intuition
The problem asks for the length of the longest continuous increasing subsequence (LCIS) in an array.
To solve this, we traverse the array while keeping track of an increasing sequence. If we encounter a number smaller than or equal to the previous one, we reset the counter. Throughout, we update the result ... | 1 | 0 | ['Array', 'Two Pointers', 'C++'] | 0 |
longest-continuous-increasing-subsequence | 100% Acceptance! ✅ | 100-acceptance-by-velan_m_velan-wqbm | VELAN.MVelan.MComplexity
Time complexity:O(n)
Space complexity:O(n)
Code | velan_m_velan | NORMAL | 2025-03-08T08:14:46.890614+00:00 | 2025-03-08T08:14:46.890614+00:00 | 105 | false | # VELAN.M
$$Velan.M$$
# Complexity
- Time complexity:$$O(n)$$
<!-- Add your time complexity here, e.g. $$O(n)$$ -->
- Space complexity:$$O(n)$$
<!-- Add your space complexity here, e.g. $$O(n)$$ -->
# Code
```cpp []
class Solution {
public:
int findLengthOfLCIS(vector<int>& nums) {
int n=nums.size(),c=0... | 1 | 0 | ['C++'] | 0 |
longest-continuous-increasing-subsequence | Beats 100 % || Easy solution || Java | beats-100-easy-solution-java-by-nikhil_s-g4o0 | IntuitionApproachComplexity
Time complexity:
Space complexity:
Code | Nikhil_Shirsath | NORMAL | 2025-02-26T06:57:17.533453+00:00 | 2025-02-26T06:57:17.533453+00:00 | 189 | false | # Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
# Approach
<!-- Describe your approach to solving the problem. -->
# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->
- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->
# Code
`... | 1 | 0 | ['Java'] | 0 |
longest-continuous-increasing-subsequence | just use the prev element with the next element! | just-use-the-prev-element-with-the-next-5kjcg | IntuitionApproachComplexity
Time complexity:
Space complexity:
Code | HLE0mPWjhW | NORMAL | 2025-02-14T11:33:37.322395+00:00 | 2025-02-14T11:33:37.322395+00:00 | 102 | false | # Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
# Approach
<!-- Describe your approach to solving the problem. -->
# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->
- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->
# Code
`... | 1 | 0 | ['Java'] | 0 |
longest-continuous-increasing-subsequence | dp easy solution (memorization concept ) c++ solution | dp-easy-solution-memorization-concept-c-b517w | IntuitionApproachComplexityo(n);
Time complexity:
Space complexity:
o(n)
Code | anandgoyal0810 | NORMAL | 2025-02-09T09:44:51.472666+00:00 | 2025-02-09T09:44:51.472666+00:00 | 95 | false | # Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
# Approach
<!-- Describe your approach to solving the problem. -->
# Complexity
o(n);
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->
- Space complexity:
- o(n)
<!-- Add your space complexity here, e.g. $$O(n)$$ ... | 1 | 0 | ['C++'] | 0 |
longest-continuous-increasing-subsequence | pointer approach easy and quick | pointer-approach-easy-and-quick-by-willw-vzko | Intuitionuse one pointer, traverse the list onceApproachComplexity
Time complexity:
O(n)
Space complexity:
O(1)Code | willw_ | NORMAL | 2025-02-07T03:08:19.544954+00:00 | 2025-02-07T03:08:19.544954+00:00 | 191 | false | # Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
use one pointer, traverse the list once
# Approach
<!-- Describe your approach to solving the problem. -->
# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. c -->
$$O(n)$$
- Space complexity:
<!-- Add your space comp... | 1 | 0 | ['Python3'] | 0 |
longest-continuous-increasing-subsequence | Easy solution using C++ |100% beats | easy-solution-using-c-100-beats-by-ravin-7mmc | Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time | RAVINDRAN_S | NORMAL | 2024-11-21T04:46:03.267541+00:00 | 2024-11-21T04:46:03.267576+00:00 | 13 | false | # Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:O(n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:O(1)\n<!-- Add your space complexity here, e.g. $$O... | 1 | 0 | ['C++'] | 0 |
longest-continuous-increasing-subsequence | Easy Solution. Beats 94%. | easy-solution-beats-94-by-akshat_04-9q7e | Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time | Akshat_04 | NORMAL | 2024-07-17T07:55:51.198331+00:00 | 2024-07-17T07:55:51.198351+00:00 | 9 | false | # Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n- O(n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O... | 1 | 0 | ['C++'] | 0 |
longest-continuous-increasing-subsequence | Beats 95% users, simple | beats-95-users-simple-by-anil_kumar_2002-v2ps | Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time | anil_kumar_2002 | NORMAL | 2024-06-09T08:29:57.819158+00:00 | 2024-06-09T08:29:57.819187+00:00 | 2 | false | # Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\nO(n)\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$... | 1 | 0 | ['C++'] | 0 |
longest-continuous-increasing-subsequence | c++ counting | c-counting-by-2004sherry-zbvt | Intuition\n Describe your first thoughts on how to solve this problem. \n\n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Tim | 2004sherry | NORMAL | 2024-05-30T10:16:13.859500+00:00 | 2024-05-30T10:16:13.859524+00:00 | 47 | false | # Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ ... | 1 | 0 | ['C++'] | 0 |
longest-continuous-increasing-subsequence | Naive Approach || 68% TC || 61% S.C || CPP | naive-approach-68-tc-61-sc-cpp-by-ganesh-l2so | Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time | Ganesh_ag10 | NORMAL | 2024-04-08T23:46:50.018296+00:00 | 2024-04-08T23:46:50.018338+00:00 | 533 | false | # Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:O(n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:O(1)\n<!-- Add your space complexity here, e.g. $$O... | 1 | 0 | ['C++'] | 0 |
longest-continuous-increasing-subsequence | Java solution (Beats 100%) | java-solution-beats-100-by-vidojevica-lg1v | Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time | vidojevica | NORMAL | 2023-11-28T21:18:18.169510+00:00 | 2023-11-28T21:18:18.169540+00:00 | 9 | false | # Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ --... | 1 | 0 | ['Array', 'Java'] | 0 |
longest-continuous-increasing-subsequence | Using sliding window + lagging pointer concept | using-sliding-window-lagging-pointer-con-aq09 | Intuition\nUsing Sliding window + lagging pointer concept.\n\n# Approach\nWe need to find the cases for which we update the lagging pointer as we move our slidi | rahulthankachan | NORMAL | 2023-10-21T18:35:31.208956+00:00 | 2023-10-21T18:35:31.208980+00:00 | 168 | false | # Intuition\nUsing Sliding window + lagging pointer concept.\n\n# Approach\nWe need to find the cases for which we update the lagging pointer as we move our sliding window.\n- Bad case1: nums[i + 1] > nums[i]\n- Bad case2: when we have reached the end of the array.\n# Complexity\n- Time complexity: O(n)\n\n- Space comp... | 1 | 0 | ['Sliding Window', 'Java'] | 2 |
longest-continuous-increasing-subsequence | ✅ [C++] EASY Solution || LIS+Slight Modification | c-easy-solution-lisslight-modification-b-i9g6 | Just the Longest Increasing Subsequence Code+ Slight modification.\nWe need continuous LIS which means difference between adjacent index should be 1. That\'s it | The_Nitin | NORMAL | 2023-07-31T01:30:02.881334+00:00 | 2023-07-31T01:31:03.706183+00:00 | 112 | false | Just the ***Longest Increasing Subsequence Code+ Slight modification.***\nWe need ***continuous LIS*** which means difference between adjacent index should be 1. That\'s it \uD83D\uDE42\n```\nclass Solution {\npublic:\n int findLengthOfLCIS(vector<int>& nums) {\n int n=nums.size();\n vector<vector<int>... | 1 | 0 | ['Dynamic Programming'] | 0 |
longest-continuous-increasing-subsequence | Python short 1-liner. Functional programming. | python-short-1-liner-functional-programm-hso3 | Approach\n1. For each adjacent pairwise numbers in nums check if nums_i < nums_{i + 1} to form a boolean array. (Useful to see bools as 1 and 0).\nlt_bools = st | darshan-as | NORMAL | 2023-07-21T10:08:00.636627+00:00 | 2023-07-21T10:08:00.636657+00:00 | 912 | false | # Approach\n1. For each adjacent `pairwise` numbers in `nums` check if $$nums_i < nums_{i + 1}$$ to form a boolean array. (Useful to see bools as 1 and 0).\n`lt_bools = starmap(lt, pairwise(nums))`\n\n2. Calculate `running_sums` on the array of bools and reset every time a `0` is found.\n`run_sums = accumulate(lt_bools... | 1 | 0 | ['Array', 'Dynamic Programming', 'Prefix Sum', 'Python', 'Python3'] | 0 |
longest-continuous-increasing-subsequence | C++ solution | 87.72% time, 94.70% space | update max length on the fly | c-solution-8772-time-9470-space-update-m-ow4o | Complexity\n- Time complexity: O(n)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity: O(1)\n Add your space complexity here, e.g. O(n) \n\n# Co | photon_einstein | NORMAL | 2023-04-14T15:37:14.680737+00:00 | 2023-04-14T15:37:14.680775+00:00 | 1,143 | false | # Complexity\n- Time complexity: O(n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n int findLengthOfLCIS(vector<int>& nums);\n};\n/*************************************************... | 1 | 0 | ['C++'] | 1 |
longest-continuous-increasing-subsequence | JavaScript / TypeScript Solution | javascript-typescript-solution-by-plskz-re1f | Code\n\n\nExample\n\n\n// cur=1, ans=1\n\n// [1,3,5,4,7] 3 > 1\n// 0 1 2 3 4 < i=1\n\n// cur=2, ans=2\n\n// [1,3,5,4,7] 5 > 3\n// 0 1 2 3 4 < i=2\n\n// cur= | plskz | NORMAL | 2023-03-30T14:28:18.737602+00:00 | 2023-03-30T14:28:18.737627+00:00 | 66 | false | # Code\n\n<details>\n<summary>Example</summary>\n\n```\n// cur=1, ans=1\n\n// [1,3,5,4,7] 3 > 1\n// 0 1 2 3 4 < i=1\n\n// cur=2, ans=2\n\n// [1,3,5,4,7] 5 > 3\n// 0 1 2 3 4 < i=2\n\n// cur=3, ans=3\n\n// [1,3,5,4,7] 4 > 5 \n// 0 1 2 3 4 < i=3\n\n// cur=1, ans=3\n\n// [1,3,5,4,7] 7 > 4 \n// 0 1 2 3 4 < i=4\n\n//... | 1 | 0 | ['Dynamic Programming', 'TypeScript', 'JavaScript'] | 0 |
longest-continuous-increasing-subsequence | JavaScript easy single loop | javascript-easy-single-loop-by-pradeepsa-n6wi | Intuition\n Describe your first thoughts on how to solve this problem. \n increasing the counter by comparing elements in an array\n# Approach\n Describe you | PradeepSaravanau | NORMAL | 2023-03-28T02:40:06.573225+00:00 | 2023-03-28T02:40:06.573261+00:00 | 46 | false | # Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n increasing the counter by comparing elements in an array\n# Approach\n<!-- Describe your approach to solving the problem. -->\ncompare two elements nums[i] and nums[i-1], if i is greater we include it, so count++, if not we reset coun... | 1 | 0 | ['JavaScript'] | 0 |
longest-continuous-increasing-subsequence | 2 DP APPROACH | C++ | BEATS 95% | O(N) | 2-dp-approach-c-beats-95-on-by-kr_vishnu-91fr | Complexity\n- Time complexity: O(N)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity: O(N)\n Add your space complexity here, e.g. O(n) \n# 1st | kr_vishnu | NORMAL | 2023-01-23T08:21:27.605491+00:00 | 2023-01-23T08:21:27.605521+00:00 | 464 | false | # Complexity\n- Time complexity: O(N)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(N)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n# 1st APPROACH: \n# Code\n```\nclass Solution {\npublic:\n int dp[10001];\n int solve(vector<int>& nums, int i, int n){\n if(i==n... | 1 | 0 | ['C++'] | 0 |
longest-continuous-increasing-subsequence | c++ | easy | fast | c-easy-fast-by-venomhighs7-dnfv | \n\n# Code\n\nclass Solution {\npublic:\n int findLengthOfLCIS(vector<int>& nums) {\n if(nums.size()<=1)return nums.size();\n int answer=1,coun | venomhighs7 | NORMAL | 2022-11-30T16:36:30.518967+00:00 | 2022-11-30T16:36:30.519018+00:00 | 1,068 | false | \n\n# Code\n```\nclass Solution {\npublic:\n int findLengthOfLCIS(vector<int>& nums) {\n if(nums.size()<=1)return nums.size();\n int answer=1,count=1;\n for(int i=0;i<nums.size()-1;i++){\n if(nums[i]<nums[i+1]){\n count++;\n answer=max(answer,count);\n ... | 1 | 0 | ['C++'] | 1 |
longest-continuous-increasing-subsequence | Two Simple Python Solutions | two-simple-python-solutions-by-deleted_u-arjz | \nclass Solution:\n def findLengthOfLCIS(self, nums: List[int]) -> int:\n prev, cur, res = 0, 0, 0\n \n for n in nums:\n cur | deleted_user | NORMAL | 2022-10-31T13:52:11.253591+00:00 | 2022-10-31T14:02:04.916584+00:00 | 787 | false | ```\nclass Solution:\n def findLengthOfLCIS(self, nums: List[int]) -> int:\n prev, cur, res = 0, 0, 0\n \n for n in nums:\n cur = cur + 1 if prev < n else 1\n res = max(res, cur)\n prev = n\n\n return res\n\nTime complexity: O(n)\nSpace complexity: O(1)\n`... | 1 | 0 | [] | 0 |
longest-continuous-increasing-subsequence | Easy to understand | easy-to-understand-by-letmefindanother11-dkpd | \n int findLengthOfLCIS(vector<int>& nums) \n {\n int mx=0;\n int n=nums.size();\n int count=1;\n int i=0,j=1;\n if(n== | LetMeFindAnother111121itr | NORMAL | 2022-09-07T16:48:44.773937+00:00 | 2022-09-07T16:48:44.773982+00:00 | 288 | false | ```\n int findLengthOfLCIS(vector<int>& nums) \n {\n int mx=0;\n int n=nums.size();\n int count=1;\n int i=0,j=1;\n if(n==1) return 1;\n \n while(j<n)\n {\n if(nums[i]<nums[j])\n {\n count++;\n i++;\n ... | 1 | 0 | ['Two Pointers', 'C', 'C++'] | 0 |
longest-continuous-increasing-subsequence | C++ | 2 Ways | Brute Force vs Optimal | c-2-ways-brute-force-vs-optimal-by-gkara-mhzo | \n/*\n\tBrute Force\n*/\nint findLengthOfLCIS(vector<int>& nums) {\n\tint ans = 1;\n\tint i = 0;\n\twhile(i < nums.size()) {\n\t\tint m = 1;\n\t\tfor (int j = i | gkaran | NORMAL | 2022-09-04T00:58:48.602678+00:00 | 2022-09-04T00:58:48.602788+00:00 | 351 | false | ```\n/*\n\tBrute Force\n*/\nint findLengthOfLCIS(vector<int>& nums) {\n\tint ans = 1;\n\tint i = 0;\n\twhile(i < nums.size()) {\n\t\tint m = 1;\n\t\tfor (int j = i + 1; j < nums.size(); ++j) {\n\t\t\tif (nums[j] > nums[j - 1]) {\n\t\t\t\tm++;\n\t\t\t} else {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tans = max(ans, m);\n\t\t... | 1 | 0 | ['C'] | 0 |
longest-continuous-increasing-subsequence | C++ super-easy understanding solution (non-sliding window approach) | c-super-easy-understanding-solution-non-2uapu | \nclass Solution {\npublic:\n int findLengthOfLCIS(vector<int>& nums) \n {\n if(nums.size() == 0) return 0;\n vector<int> dp(nums.size(), -1 | macbookair | NORMAL | 2022-07-05T06:49:44.224242+00:00 | 2022-07-09T20:26:27.988888+00:00 | 25 | false | ```\nclass Solution {\npublic:\n int findLengthOfLCIS(vector<int>& nums) \n {\n if(nums.size() == 0) return 0;\n vector<int> dp(nums.size(), -1);\n for(int i=0; i<nums.size(); ++i)\n {\n if(dp[i] == -1)\n {\n dfs(nums, dp, i); \n }\n ... | 1 | 0 | ['Dynamic Programming', 'Depth-First Search'] | 0 |
longest-continuous-increasing-subsequence | Java 1ms Easy Solution | java-1ms-easy-solution-by-varnit_gupta47-p2ey | \t\tint n=nums.length;\n int c=0;\n int maxx=0;\n for(int i=0;inums[i]){\n c++;\n maxx=Math.max(maxx,c);\n | Varnit_gupta47 | NORMAL | 2022-06-22T09:59:02.938931+00:00 | 2022-06-22T09:59:02.938982+00:00 | 72 | false | \t\tint n=nums.length;\n int c=0;\n int maxx=0;\n for(int i=0;i<n-1;i++){\n if(nums[i+1]>nums[i]){\n c++;\n maxx=Math.max(maxx,c);\n }else{\n c=0;\n }\n }\n return maxx+1;\n | 1 | 0 | ['Iterator'] | 1 |
longest-continuous-increasing-subsequence | ✔️ Easy C++ Solution | easy-c-solution-by-soorajks2002-qody | \nclass Solution {\npublic:\n int findLengthOfLCIS(vector<int>& nums) {\n int curr=1, ans=1;\n for(int i=1; i<nums.size(); ++i){\n i | soorajks2002 | NORMAL | 2022-06-19T02:54:04.269047+00:00 | 2022-06-19T02:54:04.269074+00:00 | 263 | false | ```\nclass Solution {\npublic:\n int findLengthOfLCIS(vector<int>& nums) {\n int curr=1, ans=1;\n for(int i=1; i<nums.size(); ++i){\n if(nums[i]>nums[i-1]) ++curr;\n else curr=1;\n ans = max(ans, curr);\n }\n return ans;\n }\n};\n``` | 1 | 0 | ['C', 'C++'] | 0 |
longest-continuous-increasing-subsequence | C++ Simple Solution | c-simple-solution-by-beast_paw-c00u | \nclass Solution {\npublic:\n int findLengthOfLCIS(vector<int>& nums) {\n int ans=0;\n int temp=1;\n for(int i=0;i<nums.size()-1;i++)\n | beast_paw | NORMAL | 2022-05-21T14:01:13.252238+00:00 | 2022-05-21T14:01:13.252280+00:00 | 45 | false | ```\nclass Solution {\npublic:\n int findLengthOfLCIS(vector<int>& nums) {\n int ans=0;\n int temp=1;\n for(int i=0;i<nums.size()-1;i++)\n {\n if(nums[i+1]>nums[i])\n temp++;\n else\n { \n ans=max(ans,temp);\n ... | 1 | 0 | ['C'] | 0 |
longest-continuous-increasing-subsequence | Very simple C++ solution. | very-simple-c-solution-by-hariom510-hqxh | \nclass Solution {\npublic:\n int findLengthOfLCIS(vector<int>& nums) {\n int count =1;\n int maxi =1;\n \n for(int i=0; i<nums.s | Hariom510 | NORMAL | 2022-03-26T11:09:25.143539+00:00 | 2022-03-26T11:09:25.143566+00:00 | 60 | false | ```\nclass Solution {\npublic:\n int findLengthOfLCIS(vector<int>& nums) {\n int count =1;\n int maxi =1;\n \n for(int i=0; i<nums.size()-1; i++){\n if(nums[i+1] > nums[i]){\n count++;\n maxi = max(maxi, count); \n }\n else{\n... | 1 | 0 | ['C'] | 0 |
longest-continuous-increasing-subsequence | 6 lines solution | Python | DP | Self explanantory | 6-lines-solution-python-dp-self-explanan-wrmw | \nclass Solution:\n def findLengthOfLCIS(self, nums: List[int]) -> int:\n n = len( nums)\n d = [1 for i in range (n)]\n for i in range ( | krunalk013 | NORMAL | 2022-02-26T09:35:51.314163+00:00 | 2022-02-26T09:35:51.314194+00:00 | 155 | false | ```\nclass Solution:\n def findLengthOfLCIS(self, nums: List[int]) -> int:\n n = len( nums)\n d = [1 for i in range (n)]\n for i in range (1,n):\n if nums[i] > nums[i-1]:\n d[i] += d[i-1]\n return max(d) \n``` | 1 | 0 | ['Dynamic Programming', 'Python'] | 0 |
longest-continuous-increasing-subsequence | C++ || EASY TO UNDERSTAND | c-easy-to-understand-by-easy_coder-2tuo | ```\nclass Solution {\npublic:\n int findLengthOfLCIS(vector& nums) {\n int ans = 1;\n int n = nums.size();\n if(n == 1) return 1;\n | Easy_coder | NORMAL | 2022-02-23T08:59:31.747943+00:00 | 2022-02-23T08:59:31.747981+00:00 | 78 | false | ```\nclass Solution {\npublic:\n int findLengthOfLCIS(vector<int>& nums) {\n int ans = 1;\n int n = nums.size();\n if(n == 1) return 1;\n \n int i=0, j = 1;\n while( j < n ){\n if(nums[j] > nums[j-1]){\n ans = max(ans, (j - i + 1));\n ... | 1 | 0 | ['C'] | 0 |
longest-continuous-increasing-subsequence | O(n) time and O(1) space C++ Solution | on-time-and-o1-space-c-solution-by-lites-ulrn | \nclass Solution {\npublic:\n int findLengthOfLCIS(vector<int>& nums) {\n int result=0;\n int curr = nums[0];\n int count=1;\n if | liteshghute | NORMAL | 2022-02-04T16:37:43.856284+00:00 | 2022-02-04T16:37:43.856313+00:00 | 57 | false | ```\nclass Solution {\npublic:\n int findLengthOfLCIS(vector<int>& nums) {\n int result=0;\n int curr = nums[0];\n int count=1;\n if(nums.size()==1)\n return 1;\n if(nums.size()==0)\n return 0;\n for(int i=1; i<nums.size(); i++){\n if(nums[i]... | 1 | 0 | [] | 0 |
longest-continuous-increasing-subsequence | rust windows | rust-windows-by-zakharovvi-aobo | \npub struct Solution {}\n\nimpl Solution {\n pub fn find_length_of_lcis(nums: Vec<i32>) -> i32 {\n let mut max = 0;\n let accum = nums\n | zakharovvi | NORMAL | 2021-12-25T09:11:41.930426+00:00 | 2021-12-25T09:11:41.930493+00:00 | 115 | false | ```\npub struct Solution {}\n\nimpl Solution {\n pub fn find_length_of_lcis(nums: Vec<i32>) -> i32 {\n let mut max = 0;\n let accum = nums\n .windows(2)\n .fold(1, |accum, w| {\n if w[0] < w[1] {\n accum + 1\n } else {\n ... | 1 | 0 | ['Rust'] | 0 |
longest-continuous-increasing-subsequence | BEST SOLUTION C++ | best-solution-c-by-harryson03-lpsy | class Solution {\npublic:\n int findLengthOfLCIS(vector& nums) {\n int n=nums.size();\n vectorcnt(n,1);\n int ans=1;\n for(int i= | harryson03 | NORMAL | 2021-11-26T15:58:03.431284+00:00 | 2021-11-26T15:58:03.431315+00:00 | 52 | false | class Solution {\npublic:\n int findLengthOfLCIS(vector<int>& nums) {\n int n=nums.size();\n vector<int>cnt(n,1);\n int ans=1;\n for(int i=1;i<n;i++)\n {\n if(nums[i]>nums[i-1])\n {\n cnt[i]=cnt[i-1]+1;\n }\n ans=max(ans,cn... | 1 | 0 | [] | 0 |
longest-continuous-increasing-subsequence | C++ | 98.89% | easy | c-9889-easy-by-omanandpandey-l8gh | \nclass Solution {\npublic:\n int findLengthOfLCIS(vector<int>& nums) {\n \n int count = 0, i= 0, maxa=INT_MIN;\n \n for( | OmAnandPandey | NORMAL | 2021-11-03T19:25:42.578772+00:00 | 2021-11-03T19:25:42.578812+00:00 | 150 | false | ```\nclass Solution {\npublic:\n int findLengthOfLCIS(vector<int>& nums) {\n \n int count = 0, i= 0, maxa=INT_MIN;\n \n for(int j = 0; j < nums.size(); j++)\n {\n if(j == nums.size()-1)\n {\n count = j-i+1;\n }... | 1 | 0 | ['C'] | 0 |
longest-continuous-increasing-subsequence | Java, O(N) time, O(1) space, beat 99.8% | java-on-time-o1-space-beat-998-by-phung_-fqjj | ```\nclass Solution {\n public int findLengthOfLCIS(int[] nums) {\n int index = 0;\n int ans = 1;\n while(index < nums.length) {\n | phung_manh_cuong | NORMAL | 2021-11-03T05:40:59.216923+00:00 | 2021-11-03T05:40:59.216965+00:00 | 39 | false | ```\nclass Solution {\n public int findLengthOfLCIS(int[] nums) {\n int index = 0;\n int ans = 1;\n while(index < nums.length) {\n int base = index;\n while(index < nums.length-1 && nums[index] < nums[index+1]) index++;\n if(index == base) {\n inde... | 1 | 1 | [] | 0 |
longest-continuous-increasing-subsequence | Using sliding window of dynamic size easy c++ better than 99% in time | using-sliding-window-of-dynamic-size-eas-11j3 | \nclass Solution {\npublic:\n int findLengthOfLCIS(vector<int>& nums) {\n int i = 0;\n int ml = 1;\n int j = 1;\n for(j;j<nums.si | jainav_agarwal | NORMAL | 2021-10-25T15:11:06.463492+00:00 | 2021-10-25T15:11:06.463536+00:00 | 169 | false | ```\nclass Solution {\npublic:\n int findLengthOfLCIS(vector<int>& nums) {\n int i = 0;\n int ml = 1;\n int j = 1;\n for(j;j<nums.size();j++){\n if(nums[j]<=nums[j-1]){\n ml = max(ml,j-i);\n i= j;\n }\n }\n if(nums[j-1]>num... | 1 | 0 | ['C', 'Sliding Window', 'C++'] | 0 |
longest-continuous-increasing-subsequence | Easy JAVA Solution One Pass (On - time, O1 - space) | easy-java-solution-one-pass-on-time-o1-s-is42 | \nclass Solution {\n public int findLengthOfLCIS(int[] nums) {\n int res = 0, temp = 1;\n\n for (int i = 1; i < nums.length; i++) {\n int curr = num | movsar | NORMAL | 2021-09-21T21:02:10.329932+00:00 | 2021-09-21T21:02:10.329983+00:00 | 139 | false | ```\nclass Solution {\n public int findLengthOfLCIS(int[] nums) {\n int res = 0, temp = 1;\n\n for (int i = 1; i < nums.length; i++) {\n int curr = nums[i];\n int prev = nums[i-1];\n\n if (prev < curr) {\n temp++;\n } else {\n res = Math.max(res, temp);\n temp = 1;\n ... | 1 | 0 | ['Java'] | 0 |
longest-continuous-increasing-subsequence | Python3 solution | python3-solution-by-florinnc1-d6ok | \'\'\'\n\nclass Solution:\n def findLengthOfLCIS(self, nums: List[int]) -> int:\n msf = 0 # maxim so far\n meh = 1 # maxim ending here\n | FlorinnC1 | NORMAL | 2021-09-18T12:48:18.116814+00:00 | 2021-09-18T12:48:18.116845+00:00 | 251 | false | \'\'\'\n```\nclass Solution:\n def findLengthOfLCIS(self, nums: List[int]) -> int:\n msf = 0 # maxim so far\n meh = 1 # maxim ending here\n n = len(nums)\n if n == 1: return 1\n last = nums[0]\n for i in range(1, n):\n if nums[i] > last:\n last = ... | 1 | 0 | ['Python', 'Python3'] | 0 |
longest-continuous-increasing-subsequence | python3 stack fast easy solution | python3-stack-fast-easy-solution-by-bich-hekc | \nclass Solution:\n def findLengthOfLCIS(self, nums: List[int]) -> int:\n stack = [nums[0]]\n ret = 1\n for i in range(1, len(nums)):\n | bichengwang | NORMAL | 2021-09-18T01:42:23.981506+00:00 | 2021-09-21T05:51:00.316561+00:00 | 163 | false | ```\nclass Solution:\n def findLengthOfLCIS(self, nums: List[int]) -> int:\n stack = [nums[0]]\n ret = 1\n for i in range(1, len(nums)):\n if stack and stack[-1] >= nums[i]: stack.clear()\n stack.append(nums[i])\n ret = max(ret, len(stack))\n return ret\n`... | 1 | 0 | ['Stack', 'Python', 'Python3'] | 0 |
department-highest-salary | Three accpeted solutions | three-accpeted-solutions-by-kent-huang-nmao | SELECT D.Name AS Department ,E.Name AS Employee ,E.Salary \n FROM\n \tEmployee E,\n \t(SELECT DepartmentId,max(Salary) as max FROM Employee GROUP BY De | kent-huang | NORMAL | 2015-01-22T01:01:44+00:00 | 2018-10-16T16:15:03.493819+00:00 | 58,694 | false | SELECT D.Name AS Department ,E.Name AS Employee ,E.Salary \n FROM\n \tEmployee E,\n \t(SELECT DepartmentId,max(Salary) as max FROM Employee GROUP BY DepartmentId) T,\n \tDepartment D\n WHERE E.DepartmentId = T.DepartmentId \n AND E.Salary = T.max\n AND E.DepartmentId = D.id\n\n SELECT D.... | 187 | 3 | [] | 34 |
department-highest-salary | 🔥💯 [Pandas] Very simple Step by step Process (detailed)🔥💯 | pandas-very-simple-step-by-step-process-a0gh7 | \n# Approach\n Describe your approach to solving the problem. \nThe approach involves merging the DataFrames, grouping by department, and then finding the emplo | sriganesh777 | NORMAL | 2023-08-04T06:40:27.845868+00:00 | 2023-08-04T06:40:27.845906+00:00 | 15,377 | false | \n# Approach\n<!-- Describe your approach to solving the problem. -->\nThe approach involves merging the DataFrames, grouping by department, and then finding the employees with the highest salary within each group using the max function and boolean indexing. The function handles empty table scenarios and correctly rena... | 153 | 0 | ['Pandas'] | 9 |
department-highest-salary | ✅ 100% EASY || FAST 🔥|| CLEAN SOLUTION 🌟 | 100-easy-fast-clean-solution-by-kartik_k-fj1u | Code\n\n/* Write your PL/SQL query statement below */\nSELECT DEPT.name AS Department, EMP.name AS Employee, EMP.salary AS \n\nSalary FROM Department DEPT, Empl | kartik_ksk7 | NORMAL | 2023-07-28T06:37:07.250031+00:00 | 2023-08-05T05:56:21.328317+00:00 | 21,928 | false | # Code\n```\n/* Write your PL/SQL query statement below */\nSELECT DEPT.name AS Department, EMP.name AS Employee, EMP.salary AS \n\nSalary FROM Department DEPT, Employee EMP WHERE\n\nEMP.departmentId = DEPT.id AND (EMP.departmentId, salary) IN \n\n(SELECT departmentId, MAX (salary) FROM Employee GROUP BY \n\ndepartment... | 139 | 0 | ['Database', 'MySQL', 'Oracle', 'MS SQL Server'] | 11 |
department-highest-salary | Solution with Detail Explanation (Easy to Understand) | solution-with-detail-explanation-easy-to-80wr | Please upvote Me ^ Thanks.\nIT IS SIMPLE \n\nfirst identify highest salary by \nSELECT departmentId,MAX(salary) FROM Employee GROUP BY departmentId\n\nThen JOIN | Prabal_Nair | NORMAL | 2022-08-21T06:14:44.757748+00:00 | 2022-08-21T06:14:44.757782+00:00 | 22,880 | false | **Please upvote Me ^ Thanks.**\nIT IS SIMPLE \n\nfirst identify highest salary by \n`SELECT departmentId,MAX(salary) FROM Employee GROUP BY departmentId`\n\nThen JOIN both table by\n`SELECT Department.name AS Department ,Employee.name AS Employee, Employee.salary\nFROM Department JOIN Employee ON Employee.departmentI... | 120 | 0 | ['MySQL'] | 7 |
department-highest-salary | Simple solution, easy to understand | simple-solution-easy-to-understand-by-le-rw6h | SELECT dep.Name as Department, emp.Name as Employee, emp.Salary \n from Department dep, Employee emp \n where emp.DepartmentId=dep.Id \n and emp.Salary | lemonxixi | NORMAL | 2015-08-27T01:00:56+00:00 | 2018-10-06T06:59:03.531712+00:00 | 26,104 | false | SELECT dep.Name as Department, emp.Name as Employee, emp.Salary \n from Department dep, Employee emp \n where emp.DepartmentId=dep.Id \n and emp.Salary=(Select max(Salary) from Employee e2 where e2.DepartmentId=dep.Id) | 83 | 6 | [] | 12 |
department-highest-salary | Sharing my simple solution | sharing-my-simple-solution-by-mahdy-n321 | Select Department.Name, emp1.Name, emp1.Salary from \n Employee emp1 join Department on emp1.DepartmentId = Department.Id\n where emp1.Salary = (Select Ma | mahdy | NORMAL | 2015-02-09T02:59:59+00:00 | 2018-10-06T06:46:47.818894+00:00 | 10,052 | false | Select Department.Name, emp1.Name, emp1.Salary from \n Employee emp1 join Department on emp1.DepartmentId = Department.Id\n where emp1.Salary = (Select Max(Salary) from Employee emp2 where emp2.DepartmentId = emp1.DepartmentId); | 33 | 3 | [] | 5 |
department-highest-salary | Pandas vs SQL | Elegant & Short | All 30 Days of Pandas solutions ✅ | pandas-vs-sql-elegant-short-all-30-days-eysb8 | Complexity\n- Time complexity: O(n)\n- Space complexity: O(n)\n\n# Code\nPython []\ndef department_highest_salary(employee: pd.DataFrame, department: pd.DataFra | Kyrylo-Ktl | NORMAL | 2023-08-05T13:00:46.825759+00:00 | 2023-08-06T16:57:05.900946+00:00 | 4,647 | false | # Complexity\n- Time complexity: $$O(n)$$\n- Space complexity: $$O(n)$$\n\n# Code\n```Python []\ndef department_highest_salary(employee: pd.DataFrame, department: pd.DataFrame) -> pd.DataFrame:\n return employee.merge(\n department, left_on=\'departmentId\', right_on=\'id\', suffixes=(\'_employee\', \'_depart... | 32 | 0 | ['Python', 'Python3', 'MySQL', 'Pandas'] | 2 |
department-highest-salary | GROUP BY HAVING not working for multiple highest salary, why? | group-by-having-not-working-for-multiple-nap2 | SELECT b.Name as Department, a.Name as Employee, a.Salary\nFROM Employee a\nJOIN Department b\nON a.DepartmentId = b.Id\nGROUP BY Department\nHAVING a.Salary = | gogopink | NORMAL | 2015-01-23T23:44:30+00:00 | 2015-01-23T23:44:30+00:00 | 7,388 | false | `SELECT b.Name as Department, a.Name as Employee, a.Salary\nFROM Employee a\nJOIN Department b\nON a.DepartmentId = b.Id\nGROUP BY Department\nHAVING a.Salary = max(a.Salary)`\n\nThis way it was not able to return multiple rows with same highest salary. I can't figure why, please help! | 27 | 0 | [] | 7 |
department-highest-salary | MySQL partition by with join solution with explaination | mysql-partition-by-with-join-solution-wi-khlg | \nSELECT b.Name AS Department, a.Name AS Employee, Salary FROM\n(SELECT *, MAX(Salary) OVER(PARTITION BY DepartmentId) AS max_val\nFROM Employee) a\nJOIN Depart | lianj | NORMAL | 2020-05-14T14:13:37.703535+00:00 | 2020-05-14T14:13:37.703572+00:00 | 3,139 | false | ```\nSELECT b.Name AS Department, a.Name AS Employee, Salary FROM\n(SELECT *, MAX(Salary) OVER(PARTITION BY DepartmentId) AS max_val\nFROM Employee) a\nJOIN Department b\nON a.DepartmentId = b.Id\nWHERE Salary = max_val;\n```\nLogic here: add a column to the original Employee table of max salary within that department ... | 26 | 0 | ['MySQL'] | 1 |
department-highest-salary | 184: Solution with step by step explanation | 184-solution-with-step-by-step-explanati-u02y | Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\nLet\'s go through the steps:\n\nJoin the Employee and Department tables o | Marlen09 | NORMAL | 2023-02-21T14:00:25.035894+00:00 | 2023-02-21T14:00:25.035942+00:00 | 12,662 | false | # Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\nLet\'s go through the steps:\n\nJoin the Employee and Department tables on the departmentId column to get the name of the department for each employee.\nUse a subquery to get the maximum salary for each department. The subqu... | 23 | 0 | ['Database', 'MySQL'] | 7 |
department-highest-salary | Why cannot we just use max() with group by? | why-cannot-we-just-use-max-with-group-by-rzj0 | select D.name as Department, E.name as Employee, max(salary) as Salary \n from Employee E , Department D \n where E.DepartmentId = D.Id \n | markwithk | NORMAL | 2015-05-07T15:49:05+00:00 | 2015-05-07T15:49:05+00:00 | 6,895 | false | select D.name as Department, E.name as Employee, max(salary) as Salary \n from Employee E , Department D \n where E.DepartmentId = D.Id \n group by D.id\n\nI tried to use something like this, but it did not pass. When two departments has the same max salary, it only outputs one row.\n\nHowever... | 23 | 0 | [] | 14 |
department-highest-salary | simple and easy solution || MySQL | simple-and-easy-solution-mysql-by-shishi-egxo | \n# if it\'s help, please up \u2B06 vote! \u2764\uFE0F\n\n###### Let\'s Connect on LinkedIn: www.linkedin.com/in/shishirrsiam\n###### Let\'s Connect on Facebook | shishirRsiam | NORMAL | 2024-09-20T19:38:01.379613+00:00 | 2024-09-20T19:38:01.379637+00:00 | 6,216 | false | \n# if it\'s help, please up \u2B06 vote! \u2764\uFE0F\n\n###### Let\'s Connect on LinkedIn: www.linkedin.com/in/shishirrsiam\n###### Let\'s Connect on Facebook: www.fb.com/shishirrsiam\n\n# Code\n```mysql []\nselect dp.name as Department, em.name as Employee, em.salary\nfrom Employee as em join Department as dp \non e... | 21 | 0 | ['Database', 'MySQL'] | 6 |
department-highest-salary | 95% beats || MySQL solution | 95-beats-mysql-solution-by-im_obid-ede4 | \n# Code\n\nselect Department,e.name as Employee,e.salary as Salary \nfrom employee e,\n(\n select d.id department_id,d.name as Department,max(e.salary) as m | im_obid | NORMAL | 2023-01-08T12:17:30.989840+00:00 | 2023-01-08T12:17:30.989880+00:00 | 7,705 | false | \n# Code\n```\nselect Department,e.name as Employee,e.salary as Salary \nfrom employee e,\n(\n select d.id department_id,d.name as Department,max(e.salary) as max \n from department d left join employee e \n on d.id=e.departmentId \n group by d.id\n) as MaxSalaries \nwhere e.departmentId=department_id and ... | 21 | 0 | ['MySQL'] | 0 |
department-highest-salary | [Pandas] 3-line solution, beats 90% | pandas-3-line-solution-beats-90-by-dzhan-x1el | Approach\n Describe your approach to solving the problem. \nWe could do this using a series of group-by, apply and merge operations, but we can do it quickly ut | dzhang2324 | NORMAL | 2023-08-08T05:24:48.053677+00:00 | 2023-08-08T05:25:18.534499+00:00 | 1,913 | false | # Approach\n<!-- Describe your approach to solving the problem. -->\nWe could do this using a series of group-by, apply and merge operations, but we can do it quickly utilizing group-by and transform. Documentation is here: https://pandas.pydata.org/docs/reference/api/pandas.core.groupby.DataFrameGroupBy.transform.html... | 20 | 0 | ['Pandas'] | 3 |
department-highest-salary | MySQL solution using join | mysql-solution-using-join-by-yashkumarjh-rvj5 | \nSELECT D.NAME AS DEPARTMENT,\nE.NAME AS EMPLOYEE,\nE.SALARY\nFROM EMPLOYEE E\nJOIN DEPARTMENT D ON \nE.DEPARTMENTID = D.ID\nWHERE SALARY = (SELECT MAX(SALARY) | yashkumarjha | NORMAL | 2022-06-17T17:42:24.349786+00:00 | 2022-06-17T17:42:48.756149+00:00 | 3,120 | false | ```\nSELECT D.NAME AS DEPARTMENT,\nE.NAME AS EMPLOYEE,\nE.SALARY\nFROM EMPLOYEE E\nJOIN DEPARTMENT D ON \nE.DEPARTMENTID = D.ID\nWHERE SALARY = (SELECT MAX(SALARY) FROM EMPLOYEE WHERE D.ID = EMPLOYEE.DEPARTMENTID);\n```\n\nPlease upvote if you find it useful. | 19 | 1 | ['MySQL'] | 2 |
department-highest-salary | A simple solution use one join | a-simple-solution-use-one-join-by-zzhang-ucgi | select d.Name Department, e.Name Employee, Salary\nfrom Department d join Employee e on d.Id=e.DepartmentId\nwhere (Salary,d.id) in (select max(Salary),Departme | zzhang2222 | NORMAL | 2016-05-16T05:13:11+00:00 | 2016-05-16T05:13:11+00:00 | 2,463 | false | select d.Name Department, e.Name Employee, Salary\nfrom Department d join Employee e on d.Id=e.DepartmentId\nwhere (Salary,d.id) in (select max(Salary),DepartmentId from Employee group by DepartmentId); | 16 | 1 | [] | 0 |
department-highest-salary | Highest Salaries in Every Department! | highest-salaries-in-every-department-by-sqsui | Intuition:We have two tables: one with employee details and one with department details. Our task is to find the highest-paid employee in each department. This | NoobML | NORMAL | 2025-03-04T12:04:25.799813+00:00 | 2025-03-04T12:04:25.799813+00:00 | 1,942 | false | ### Intuition:
We have two tables: one with employee details and one with department details. Our task is to find the highest-paid employee in each department. This seems like a straightforward problem of **grouping employees by department** and then finding the **maximum salary** within each group.
### Approach:
1.... | 15 | 0 | ['Pandas'] | 0 |
department-highest-salary | pandas || 3 lines, merge and groupby | pandas-3-lines-merge-and-groupby-by-spau-d3gb | \nimport pandas as pd\n\ndef department_highest_salary(employee : pd.DataFrame, \n department: pd.DataFrame) -> pd.DataFrame:\n\n | Spaulding_ | NORMAL | 2024-05-14T05:59:24.343439+00:00 | 2024-05-14T05:59:24.343469+00:00 | 1,532 | false | ```\nimport pandas as pd\n\ndef department_highest_salary(employee : pd.DataFrame, \n department: pd.DataFrame) -> pd.DataFrame:\n\n df = employee.merge(department, how=\'left\', \n left_on=\'departmentId\', right_on=\'id\')\n\n grp = df.groupby(\'name_y\')[\'s... | 15 | 0 | ['Pandas'] | 0 |
department-highest-salary | My best solution, super clean, no subquery, no Max | my-best-solution-super-clean-no-subquery-klis | Oftentimes those interviewers won't allow you to write subquery~\n\nReturn the highest salary for each department\n\n SELECT D.Name as Department, E.Name a | joy4fun | NORMAL | 2017-10-27T23:11:04.180000+00:00 | 2017-10-27T23:11:04.180000+00:00 | 4,715 | false | Oftentimes those interviewers won't allow you to write subquery~\n\n**Return the highest salary for each department**\n\n SELECT D.Name as Department, E.Name as Employee, E.Salary \n FROM Department D, Employee E, Employee E2 \n WHERE D.ID = E.DepartmentId and E.DepartmentId = E2.DepartmentId and \n ... | 14 | 0 | [] | 5 |
department-highest-salary | ✅MySQL-2 Different Approach ||Easy understanding|| Beginner level|| Simple, Short ,Solution✅ | mysql-2-different-approach-easy-understa-f9ev | Please upvote to motivate me in my quest of documenting all leetcode solutions. HAPPY CODING:)\nAny suggestions and improvements are always welcome.\n____\n\u27 | Anos | NORMAL | 2022-08-13T18:44:35.529967+00:00 | 2022-08-13T18:44:35.529993+00:00 | 2,044 | false | ***Please upvote to motivate me in my quest of documenting all leetcode solutions. HAPPY CODING:)\nAny suggestions and improvements are always welcome**.*\n______________________\n\u2705 **MySQL Code :**\n***Approach 1:***\n```\nSELECT t1.Department, t1.Employee, t1.Salary\nFROM(SELECT d.name AS Department, e.name AS E... | 13 | 0 | ['MySQL'] | 1 |
department-highest-salary | Easy Solution. No joins. GROUP BY is enough. 916ms | easy-solution-no-joins-group-by-is-enoug-8kfd | select\n d.Name, e.Name, e.Salary\n from\n Department d,\n Employee e,\n (select MAX(Salary) as Salary, DepartmentId as DepartmentId from Employ | ruoyu_lei | NORMAL | 2015-07-30T23:25:55+00:00 | 2015-07-30T23:25:55+00:00 | 4,001 | false | select\n d.Name, e.Name, e.Salary\n from\n Department d,\n Employee e,\n (select MAX(Salary) as Salary, DepartmentId as DepartmentId from Employee GROUP BY DepartmentId) h\n where\n e.Salary = h.Salary and\n e.DepartmentId = h.DepartmentId and\n e.DepartmentId = d.Id; | 12 | 6 | [] | 3 |
department-highest-salary | Find Highest Salary Employees by Department (Subquery & Join) in MySQL | find-highest-salary-employees-by-departm-655a | Intuition\nTo solve the problem of retrieving the employee with the highest salary within each department, we need to:\n\n- Identify the maximum salary within e | d_sushkov | NORMAL | 2024-08-06T01:41:07.230445+00:00 | 2024-08-06T01:41:07.230479+00:00 | 2,133 | false | # Intuition\nTo solve the problem of retrieving the employee with the highest salary within each department, we need to:\n\n- Identify the maximum salary within each department.\n- Filter employees to match this maximum salary.\n- Combine this information with department names to present the result.\n\n# Approach\n1. `... | 11 | 0 | ['Database', 'MySQL'] | 0 |
department-highest-salary | ✅Easiest Basic SQL Solution wiith table explanation( No advance)✅. | easiest-basic-sql-solution-wiith-table-e-xsmx | Explanation :\nStep 1: INNER JOIN\nThe INNER JOIN combines the relevant rows from both tables based on the common departmentId and id columns.\n\nResult after t | dev_yash_ | NORMAL | 2024-01-29T14:31:56.623022+00:00 | 2024-01-29T14:34:29.927440+00:00 | 1,817 | false | **Explanation :**\n*Step 1: INNER JOIN*\nThe INNER JOIN combines the relevant rows from both tables based on the common departmentId and id columns.\n\nResult after the INNER JOIN:\n\n\n*Step 2: WHERE Clause wi... | 11 | 0 | ['MySQL', 'MS SQL Server'] | 1 |
department-highest-salary | 184. Department Highest Salary | 184-department-highest-salary-by-spauldi-t0sd | ```\nSELECT dept.Name AS Department, Employee.Name AS Employee, Salary\nFROM Employee\n\nINNER JOIN Department AS dept ON Employee.DepartmentId=dept.Id\n\nwhere | Spaulding_ | NORMAL | 2022-09-10T00:58:37.523160+00:00 | 2022-09-10T00:58:37.523195+00:00 | 1,433 | false | ```\nSELECT dept.Name AS Department, Employee.Name AS Employee, Salary\nFROM Employee\n\nINNER JOIN Department AS dept ON Employee.DepartmentId=dept.Id\n\nwhere (dept.Id, Salary) IN (SELECT DepartmentId, max(Salary)\n FROM Employee GROUP BY DepartmentId); | 11 | 0 | ['MySQL'] | 0 |
department-highest-salary | [MySQL] Find the highest salary with `rank` function | mysql-find-the-highest-salary-with-rank-8bhfb | We can either group table by DepartmentId and get the highest salary with max(salary), or use window function rank. sql SELECT department, employee, salary FRO | rudy__ | NORMAL | 2020-10-29T01:21:00.610140+00:00 | 2020-10-29T01:21:00.610185+00:00 | 1,430 | false | We can either group table by `DepartmentId` and get the highest salary with `max(salary)`, or use window function `rank`.
```sql
SELECT department, employee, salary
FROM ( SELECT a.name AS employee
, b.name AS department
, salary
, RANK() OVER (PARTITION BY b.name ORDER BY a.salary DESC) AS dr... | 11 | 0 | [] | 1 |
department-highest-salary | Share my simple query using >= ALL | share-my-simple-query-using-all-by-dottk-67ar | \nselect Department.Name as Department, e1.Name as Employee, Salary\nfrom Employee e1, Department\nwhere e1.DepartmentId = Department.Id \nand\nSalary >= ALL (s | dottkdomain | NORMAL | 2015-04-22T14:06:00+00:00 | 2015-04-22T14:06:00+00:00 | 2,409 | false | <PRE><CODE>\nselect Department.Name as Department, e1.Name as Employee, Salary\nfrom Employee e1, Department\nwhere e1.DepartmentId = Department.Id \nand\nSalary >= ALL (select Salary from Employee e2 where e2.DepartmentId = e1.DepartmentId);\n</CODE></PRE> | 11 | 0 | [] | 0 |
department-highest-salary | MySQL Solution. Window | mysql-solution-window-by-kristina_m-r7kh | Code\nmysql []\n# Write your MySQL query statement below\nselect Department, Employee, Salary from (\n select \n dense_rank() over w as top,\n | Kristina_m | NORMAL | 2024-08-25T12:45:24.077399+00:00 | 2024-08-25T12:45:24.077439+00:00 | 1,456 | false | # Code\n```mysql []\n# Write your MySQL query statement below\nselect Department, Employee, Salary from (\n select \n dense_rank() over w as top,\n d.name as Department, \n e.name as Employee,\n salary as Salary\n from Employee e\n join Department d on e.departmentId = d.id\n win... | 10 | 0 | ['MySQL'] | 0 |
department-highest-salary | Find Highest Salary Employees by Department (Merge & Filter) in Pandas | find-highest-salary-employees-by-departm-w3fw | Intuition\nTo solve the problem of finding the employee with the highest salary in each department using Pandas, start by combining the Employee and Department | d_sushkov | NORMAL | 2024-08-06T01:41:58.698223+00:00 | 2024-08-06T01:41:58.698253+00:00 | 1,773 | false | # Intuition\nTo solve the problem of finding the employee with the highest salary in each department using Pandas, start by combining the Employee and Department DataFrames. This will allow you to associate each employee with their respective department. Next, determine the highest salary within each department and fil... | 10 | 0 | ['Database', 'Pandas'] | 0 |
department-highest-salary | Find Highest Salary Employees by Department (Subquery & Join) in PostgreSQL | find-highest-salary-employees-by-departm-x0f2 | Intuition\nTo solve the problem of retrieving the employee with the highest salary within each department, we need to:\n\n- Identify the maximum salary within e | d_sushkov | NORMAL | 2024-08-06T01:41:51.823868+00:00 | 2024-08-06T01:41:51.823901+00:00 | 1,714 | false | # Intuition\nTo solve the problem of retrieving the employee with the highest salary within each department, we need to:\n\n- Identify the maximum salary within each department.\n- Filter employees to match this maximum salary.\n- Combine this information with department names to present the result.\n\n# Approach\n1. `... | 10 | 0 | ['Database', 'PostgreSQL'] | 1 |
department-highest-salary | Find Highest Salary Employees by Department (Subquery & Join) in MS SQL Server | find-highest-salary-employees-by-departm-mg33 | Intuition\nTo find the employee with the highest salary in each department using T-SQL, you need to:\n\n- Determine the maximum salary for each department.\n- F | d_sushkov | NORMAL | 2024-08-06T01:41:33.815507+00:00 | 2024-08-06T01:41:33.815533+00:00 | 831 | false | # Intuition\nTo find the employee with the highest salary in each department using T-SQL, you need to:\n\n- Determine the maximum salary for each department.\n- Filter employees to include only those with the maximum salary within their respective departments.\n- Join this filtered data with the department names to get... | 9 | 0 | ['Database', 'MS SQL Server'] | 0 |
department-highest-salary | RANK() window function | rank-window-function-by-foyhu-vh8e | Intuition\nuse rank() to rank salary partition by departments, then select rank = 1 rows\n\n# Code\n\n/* Write your T-SQL query statement below */\nWITH joined | foyhu | NORMAL | 2023-01-21T19:21:24.381175+00:00 | 2023-01-21T19:21:24.381206+00:00 | 3,626 | false | # Intuition\nuse rank() to rank salary partition by departments, then select rank = 1 rows\n\n# Code\n```\n/* Write your T-SQL query statement below */\nWITH joined as(\nSELECT d.name Department,\ne.name as Employee, \ne.salary as Salary,\nRANK() over (PARTITION BY d.name ORDER BY e.salary DESC) rank \nFROM Department ... | 9 | 0 | ['MS SQL Server'] | 2 |
department-highest-salary | Faster than 99.29% using MySQL Windowing functions (with detailed explanation) | faster-than-9929-using-mysql-windowing-f-r6sd | Runtime: 457 ms, faster than 99.29% of MySQL online submissions for Department Highest Salary.\nMemory Usage: 0B, less than 100.00% of MySQL online submissions | DataCookie | NORMAL | 2021-11-04T11:53:22.229886+00:00 | 2021-11-04T12:10:22.897154+00:00 | 1,387 | false | Runtime: 457 ms, faster than 99.29% of MySQL online submissions for Department Highest Salary.\nMemory Usage: 0B, less than 100.00% of MySQL online submissions for Department Highest Salary.\n\nExplanation: I\'m using concept of Windowing, which is [well supported by MySQL](https://dev.mysql.com/doc/refman/8.0/en/windo... | 9 | 0 | ['Sliding Window', 'MySQL'] | 1 |
department-highest-salary | Six ways to solve this | six-ways-to-solve-this-by-chamal-3kzy | Start with defining a common table expression for the join which I\'ll reuse for all solutions\n\nwith DepartmentSalary\nas\n(\nselect d.Name as Department, e.N | chamal | NORMAL | 2021-01-09T04:23:09.873215+00:00 | 2021-01-09T04:25:22.311276+00:00 | 720 | false | Start with defining a common table expression for the join which I\'ll reuse for all solutions\n```\nwith DepartmentSalary\nas\n(\nselect d.Name as Department, e.Name as Employee, e.Salary as Salary\nfrom Employee e join Department d on\n e.DepartmentId = d.Id\n)\n```\n\nSolution 1: \n```\nselect * from DepartmentSa... | 9 | 0 | [] | 0 |
department-highest-salary | Find Highest Salary Employees by Department (Subquery & Join) in Oracle | find-highest-salary-employees-by-departm-fzdn | Intuition\nTo solve the problem of retrieving the employee with the highest salary within each department, we need to:\n\n- Identify the maximum salary within e | d_sushkov | NORMAL | 2024-08-06T01:41:44.695737+00:00 | 2024-08-06T01:41:44.695759+00:00 | 706 | false | # Intuition\nTo solve the problem of retrieving the employee with the highest salary within each department, we need to:\n\n- Identify the maximum salary within each department.\n- Filter employees to match this maximum salary.\n- Combine this information with department names to present the result.\n\n# Approach\n1. `... | 8 | 0 | ['Database', 'Oracle'] | 0 |
department-highest-salary | SQL Solution | sql-solution-by-pranto1209-jq3u | Code\n\nselect Department.name as department, Employee.name as employee, salary\nfrom Employee join Department on Employee.DepartmentId = Department.Id\nwhere ( | pranto1209 | NORMAL | 2023-01-04T07:14:33.237845+00:00 | 2024-05-26T18:29:53.397250+00:00 | 3,324 | false | # Code\n```\nselect Department.name as department, Employee.name as employee, salary\nfrom Employee join Department on Employee.DepartmentId = Department.Id\nwhere (Employee.DepartmentId, Salary) in (\n select DepartmentId, max(Salary) from Employee \n group by DepartmentId\n);\n``` | 7 | 0 | ['MySQL', 'PostgreSQL'] | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.