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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
counter | ✅ 🌟 JAVASCRIPT SOLUTION ||🔥 BEATS 100% PROOF🔥|| 💡 CONCISE CODE ✅ || 🧑💻 BEGINNER FRIENDLY | javascript-solution-beats-100-proof-conc-ewte | Complexity
Time complexity:O(1)
Space complexity:O(1)
Code | Shyam_jee_ | NORMAL | 2025-03-18T16:41:33.799300+00:00 | 2025-03-18T16:41:33.799300+00:00 | 369 | false | # Complexity
- Time complexity:$$O(1)$$
<!-- Add your time complexity here, e.g. $$O(n)$$ -->
- Space complexity:$$O(1)$$
<!-- Add your space complexity here, e.g. $$O(n)$$ -->
# Code
```javascript []
/**
* @param {number} n
* @return {Function} counter
*/
var createCounter = function(n) {
return function() {
... | 2 | 0 | ['JavaScript'] | 0 |
counter | JavaScript | javascript-by-adchoudhary-6xqa | Code | adchoudhary | NORMAL | 2025-03-03T01:43:03.632268+00:00 | 2025-03-03T01:43:03.632268+00:00 | 385 | false | # Code
```javascript []
/**
* @param {number} n
* @return {Function} counter
*/
var createCounter = function(n) {
let currentCount = n - 1;
return function() {
currentCount += 1;
return currentCount;
};
};
/**
* const counter = createCounter(10)
* counter() // 10
* counter() // 11
*... | 2 | 0 | ['JavaScript'] | 0 |
counter | 🔢 Closure Counter: A JavaScript Function Factory! 🏭 | closure-counter-a-javascript-function-fa-9b42 | Intuition: 🧠💡The core idea here is to create a function (createCounter) that acts as a factory. This factory produces a new function (a counter) each time it's | cx_pirate | NORMAL | 2025-02-07T02:55:44.652805+00:00 | 2025-02-07T02:55:44.652805+00:00 | 488 | false | # Intuition: 🧠💡
The core idea here is to create a function (createCounter) that acts as a factory. This factory produces a new function (a counter) each time it's called. The created counter function, when repeatedly called, will return successive integers, starting from an initial value (n) that's passed to the fact... | 2 | 0 | ['JavaScript'] | 2 |
counter | Counter I in JavaScript and TypeScript | counter-shn-javascript-and-typescript-by-ii1w | Complexity
Time complexity: O(1)
Space complexity: O(1)
Code | x2e22PPnh5 | NORMAL | 2025-01-22T10:26:19.566954+00:00 | 2025-01-22T10:29:51.730307+00:00 | 439 | false | # Complexity
- Time complexity: O(1)
- Space complexity: O(1)
# Code
```javascript []
/**
* @param {number} n
* @return {Function} counter
*/
var createCounter = function(n) {
return () => n++;
};
```
```typescript []
function createCounter(n: number): () => number {
return () => n++;
}
``` | 2 | 0 | ['TypeScript', 'JavaScript'] | 0 |
counter | ✅EASY JAVASCRIPT SOLUTION | easy-javascript-solution-by-swayam28-nm8a | 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 | swayam28 | NORMAL | 2024-08-09T06:27:10.638219+00:00 | 2024-08-09T06:27:10.638243+00:00 | 1,209 | 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 | ['JavaScript'] | 0 |
counter | Simple JavaScript Counter with Closure | simple-javascript-counter-with-closure-b-7eyi | 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 | karanayron | NORMAL | 2024-06-11T02:53:57.916711+00:00 | 2024-06-11T02:53:57.916730+00:00 | 1,117 | 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- The time complexity of both the createCounter function and the returned function is constant, since there are no loops or recursi... | 2 | 0 | ['JavaScript'] | 0 |
counter | Counter Function Explained | JavaScript | counter-function-explained-javascript-by-ulkx | Intuition\n Describe your first thoughts on how to solve this problem. \nWe need to create a counter function that returns the current value and increments it w | samabdullaev | NORMAL | 2023-11-04T20:41:02.861473+00:00 | 2023-11-04T21:10:20.076254+00:00 | 71 | false | # Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nWe need to create a counter function that returns the current value and increments it with each call.\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n1. These are comment delimiters for a multi-line comment to he... | 2 | 0 | ['JavaScript'] | 0 |
counter | Simple Solution || 100% Beat|| | simple-solution-100-beat-by-yashmenaria-ov1f | 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 | yashmenaria | NORMAL | 2023-10-08T08:19:09.050768+00:00 | 2023-10-08T08:19:09.050792+00:00 | 4 | 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(1)\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... | 2 | 0 | ['JavaScript'] | 0 |
counter | Easy JavaScript Solution ✅🚀 | easy-javascript-solution-by-ashutosh-nai-uv3t | Code\n\n/**\n * @param {number} n\n * @return {Function} counter\n */\nvar createCounter = function(n) {\n return function() {\n return n++;\n };\n | ashutosh-naik | NORMAL | 2023-07-28T06:39:12.717202+00:00 | 2023-07-28T06:39:12.717223+00:00 | 1,148 | false | # Code\n```\n/**\n * @param {number} n\n * @return {Function} counter\n */\nvar createCounter = function(n) {\n return function() {\n return n++;\n };\n};\n\n/** \n * const counter = createCounter(10)\n * counter() // 10\n * counter() // 11\n * counter() // 12\n */\n``` | 2 | 0 | ['JavaScript'] | 0 |
counter | <JavaScript> | javascript-by-preeom-3tm0 | Code\n\n/**\n * @param {number} n\n * @return {Function} counter\n */\nvar createCounter = function(n) {\n return function() {\n return n++;\n };\n | PreeOm | NORMAL | 2023-07-27T09:47:36.307903+00:00 | 2023-07-27T09:47:36.307923+00:00 | 586 | false | # Code\n```\n/**\n * @param {number} n\n * @return {Function} counter\n */\nvar createCounter = function(n) {\n return function() {\n return n++;\n };\n};\n\n/** \n * const counter = createCounter(10)\n * counter() // 10\n * counter() // 11\n * counter() // 12\n */\n``` | 2 | 0 | ['JavaScript'] | 0 |
counter | Solved Counter Problem using PostFix Increment ✅✅ | solved-counter-problem-using-postfix-inc-bh6t | \n# Approach\nThe postfix increment operator (n++) is used to increment the value of the n variable.\n\nThe postfix increment operator is denoted by two plus si | akashtripathi08 | NORMAL | 2023-06-11T17:23:06.013783+00:00 | 2023-06-11T17:23:06.013819+00:00 | 161 | false | \n# Approach\nThe postfix increment operator (n++) is used to increment the value of the n variable.\n\nThe postfix increment operator is denoted by two plus signs (++) placed after the variable. Here\'s how it works:\n\nWhen the n++ expression is encountered, the current value of n is returned as the result of the exp... | 2 | 0 | ['JavaScript'] | 0 |
counter | ☑concise code🔥 | concise-code-by-tanmay_jaiswal-dzg6 | \nvar createCounter = function(n) {\n var counter = -1;\n return () => {return ++counter + n}; \n};\n\n | tanmay_jaiswal_ | NORMAL | 2023-05-07T17:53:54.238235+00:00 | 2023-05-07T17:53:54.238278+00:00 | 3,199 | false | ```\nvar createCounter = function(n) {\n var counter = -1;\n return () => {return ++counter + n}; \n};\n\n``` | 2 | 0 | ['JavaScript'] | 1 |
counter | Hey... It works for the provided test cases. | hey-it-works-for-the-provided-test-cases-czgj | Intuition\nMeming.\n\n# Approach\nI swear I didn\'t write the whole thing out by hand...\n\n# Complexity\n- Time complexity:\nO(69)\n\n- Space complexity:\nO(42 | user9856e | NORMAL | 2023-05-07T01:06:53.104572+00:00 | 2023-05-07T01:06:53.104595+00:00 | 455 | false | # Intuition\nMeming.\n\n# Approach\nI swear I didn\'t write the whole thing out by hand...\n\n# Complexity\n- Time complexity:\nO(69)\n\n- Space complexity:\nO(420)\n\n# Code\n```\nfunction createCounter(number) {\n let n = number - 1\n return () => {\n switch (n) {\n case -1001:\n return n = -1000\n ... | 2 | 0 | ['JavaScript'] | 3 |
counter | ✔✔Simple JavaScript Solution✔✔ | simple-javascript-solution-by-dia5408-hm67 | Approach\n Describe your approach to solving the problem. \nSimply we need to increment the counter as it call. If it is at \'n\', then in next call it will be | dia5408 | NORMAL | 2023-05-06T07:44:28.636906+00:00 | 2023-05-06T07:44:28.636952+00:00 | 2,074 | false | # Approach\n<!-- Describe your approach to solving the problem. -->\nSimply we need to increment the counter as it call. If it is at \'n\', then in next call it will be \'n+1\'. So, postfix increment will the best, which give the original value first and then increment it by one.\n\n# Code\n```\n/**\n * @param {number}... | 2 | 0 | ['JavaScript'] | 2 |
counter | 🏆️ JS simplest one liner | js-simplest-one-liner-by-klemo1997-nh29 | Complexity\n- Time complexity:\nO(1)\n\n- Space complexity:\nO(1)\n\n# Code\n\n/**\n * @param {number} n\n * @return {Function} counter\n */\nconst createCounte | Klemo1997 | NORMAL | 2023-05-06T06:21:38.608263+00:00 | 2023-05-06T06:22:04.657268+00:00 | 212 | false | # Complexity\n- Time complexity:\n$$O(1)$$\n\n- Space complexity:\n$$O(1)$$\n\n# Code\n```\n/**\n * @param {number} n\n * @return {Function} counter\n */\nconst createCounter = n => () => n++;\n``` | 2 | 0 | ['JavaScript'] | 0 |
counter | Clousure solution | clousure-solution-by-rock070-w2c6 | Intuition\n Describe your first thoughts on how to solve this problem. \n\nLook like can be solved by JavaScript closure.\n\n# Approach\n Describe your approach | Rock070 | NORMAL | 2023-05-06T04:35:12.345299+00:00 | 2023-05-06T04:35:12.345343+00:00 | 810 | false | # Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\nLook like can be solved by JavaScript closure.\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\nUse JavaScript closure store a variable num, then inside the return function plus and assign the variable, and retu... | 2 | 0 | ['TypeScript', 'JavaScript'] | 0 |
counter | O(1) || EASIEST || 1 LINER | o1-easiest-1-liner-by-arya_ratan-bm8t | Intuition\nWe should keep count of function call.\n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time complexity:\n Add your | arya_ratan | NORMAL | 2023-05-06T02:37:04.464991+00:00 | 2023-05-06T02:37:04.465024+00:00 | 1,243 | false | # Intuition\nWe should keep count of function call.\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```\n/**\n * @pa... | 2 | 0 | ['JavaScript'] | 0 |
counter | Easy approach | easy-approach-by-mrigank_2003-5m58 | \n\n# Code\n\n/**\n * @param {number} n\n * @return {Function} counter\n */\nvar createCounter = function(n) {\n return function() {\n return n++;\n | mrigank_2003 | NORMAL | 2023-05-06T02:06:45.613650+00:00 | 2023-05-06T02:06:45.613687+00:00 | 2,255 | false | \n\n# Code\n```\n/**\n * @param {number} n\n * @return {Function} counter\n */\nvar createCounter = function(n) {\n return function() {\n return n++;\n };\n};\n\n/** \n * const counter = createCounter(10)\n * counter() // 10\n * counter() // 11\n * counter() // 12\n */\n``` | 2 | 0 | ['JavaScript'] | 0 |
counter | Easy to understand solution ! ! | easy-to-understand-solution-by-enzopay-pcdr | Intuition\n Describe your first thoughts on how to solve this problem. \n- In the function counter, the n is a local variable so we just use n++ to change the v | EnzoPay | NORMAL | 2023-05-06T00:54:46.295125+00:00 | 2023-05-06T00:54:46.295171+00:00 | 1,472 | false | # Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n- In the function `counter`, the `n` is a local variable so we just use `n++` to change the value each time.\n# Approach\n<!-- Describe your approach to solving the problem. -->\n- The thing is, `return n++` will return the value of `n` f... | 2 | 0 | ['JavaScript'] | 0 |
counter | ⭐⭐ Two Words Code ⭐⭐ | two-words-code-by-younus-sid-3qsx | Approach\nJust \'return n++\'\nIt will simply first return \'n\' and then will change \'n\' to \'n+1\'.\n\n# Code\n\n/**\n * @param {number} n\n * @return {Func | younus-Sid | NORMAL | 2023-04-15T05:23:53.800088+00:00 | 2023-04-15T05:23:53.800118+00:00 | 88 | false | # Approach\nJust \'return n++\'\nIt will simply first return \'n\' and then will change \'n\' to \'n+1\'.\n\n# Code\n```\n/**\n * @param {number} n\n * @return {Function} counter\n */\nvar createCounter = function(n) {\n return function() {\n return n++;\n };\n};\n\n/** \n * const counter = createCounter(1... | 2 | 0 | ['JavaScript'] | 0 |
counter | the most simple code | the-most-simple-code-by-joonseolee-wi04 | javascript\nvar createCounter = function(n) {\n return function() {\n return n++;\n };\n};\n | joonseolee | NORMAL | 2023-04-12T12:10:55.785702+00:00 | 2023-04-12T12:11:13.067854+00:00 | 2,161 | false | ```javascript\nvar createCounter = function(n) {\n return function() {\n return n++;\n };\n};\n``` | 2 | 0 | ['JavaScript'] | 0 |
counter | 🔥 [LeetCode The Hard Way] 🔥 n++ | leetcode-the-hard-way-n-by-tr1nity-r88x | Javascript\n\njs\nvar createCounter = function(n) {\n return function() {\n return n++;\n };\n};\n\n\nTypescript\n\nts\nfunction createCounter(n: n | __wkw__ | NORMAL | 2023-04-12T12:02:29.223709+00:00 | 2023-04-12T12:02:57.860498+00:00 | 1,790 | false | Javascript\n\n```js\nvar createCounter = function(n) {\n return function() {\n return n++;\n };\n};\n```\n\nTypescript\n\n```ts\nfunction createCounter(n: number): () => number {\n return function() {\n return n++;\n }\n}\n``` | 2 | 0 | ['TypeScript', 'JavaScript'] | 0 |
counter | Easy Solution | easy-solution-by-jahongirhacking-15tl | Code\n\n/**\n * @param {number} n\n * @return {Function} counter\n */\nvar createCounter = function(n) {\n return function() {\n return n++;\n };\n | Jahongirhacking | NORMAL | 2023-04-11T22:15:12.062275+00:00 | 2023-04-11T22:15:12.062308+00:00 | 965 | false | # Code\n```\n/**\n * @param {number} n\n * @return {Function} counter\n */\nvar createCounter = function(n) {\n return function() {\n return n++;\n };\n};\n\n/** \n * const counter = createCounter(10)\n * counter() // 10\n * counter() // 11\n * counter() // 12\n */\n``` | 2 | 0 | ['JavaScript'] | 2 |
counter | One Line Solution || Super Easy to Understand | one-line-solution-super-easy-to-understa-r9mj | javascript\n/**\n * @param {number} n\n * @return {Function} counter\n */\nvar createCounter = function(n) {\n return function() {\n return n++;\n | Heber_Alturria | NORMAL | 2023-04-11T21:57:06.774274+00:00 | 2023-04-11T21:57:06.774319+00:00 | 812 | false | ```javascript\n/**\n * @param {number} n\n * @return {Function} counter\n */\nvar createCounter = function(n) {\n return function() {\n return n++;\n };\n};\n``` | 2 | 0 | ['JavaScript'] | 0 |
counter | thisMyAnswer#30 | thismyanswer30-by-rwc8cinz7h-h1uq | IntuitionApproachComplexity
Time complexity:
Space complexity:
Code | RwC8cINz7h | NORMAL | 2025-03-30T19:43:09.475463+00:00 | 2025-03-30T19:43:09.475463+00:00 | 172 | 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 | ['JavaScript'] | 0 |
counter | easy solution | easy-solution-by-haneen_ep-rkuu | IntuitionApproachComplexity
Time complexity:
Space complexity:
Code | haneen_ep | NORMAL | 2025-03-30T07:54:27.286503+00:00 | 2025-03-30T07:54:27.286503+00:00 | 183 | 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 | ['JavaScript'] | 0 |
counter | leetcodedaybyday - Beats 100% with JavaScript - 100% with TypeScript | leetcodedaybyday-beats-100-with-javascri-wv7h | IntuitionThe problem requires us to create a function that maintains a counter, which starts at a given integer n and increments by 1 each time it is called. Th | tuanlong1106 | NORMAL | 2025-03-06T09:07:03.320240+00:00 | 2025-03-06T09:07:03.320240+00:00 | 220 | false | # Intuition
The problem requires us to create a function that maintains a counter, which starts at a given integer `n` and increments by `1` each time it is called. The function should return the current value before incrementing.
# Approach
1. Define a function `createCounter(n)` that takes an integer `n` as input.
2... | 1 | 0 | ['TypeScript', 'JavaScript'] | 0 |
counter | 👉🏻 EASY TO IMPLIMENT SOLUTION || BEAT 75+% || JUST RETURN N++ || JS | easy-to-impliment-solution-beat-75-just-wqns4 | IntuitionApproachComplexity
Time complexity:
Space complexity:
Code | Siddarth9911 | NORMAL | 2025-01-13T17:06:51.658042+00:00 | 2025-01-13T17:06:51.658042+00:00 | 352 | 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 | ['JavaScript'] | 0 |
counter | JavaScript Closure and Arrow functions | javascript-closure-and-arrow-functions-b-1jxf | DescriptionI defined createCounter which can take a function as a parameter, then an arrow function that returns n and its increments.Key Concepts
Closure
Highe | eduperezn | NORMAL | 2025-01-10T18:43:33.094839+00:00 | 2025-01-10T18:43:33.094839+00:00 | 100 | false | # Description
I defined createCounter which can take a function as a parameter, then an arrow function that returns n and its increments.
# Key Concepts
- Closure
- Higher-order functions
- Anonymous functions
- Arrow functions
- Increment operator (n++)
- State persistence
- Encapsulation
# Code
```javascript []
fu... | 1 | 0 | ['JavaScript'] | 0 |
counter | 📌This is my Best solution😍 | this-is-my-best-solution-by-twiyjrg6vp-81mb | IntuitionApproachComplexity
Time complexity:
Space complexity:
Code | tWiYJRg6VP | NORMAL | 2024-12-22T23:56:36.630707+00:00 | 2024-12-22T23:56:36.630707+00:00 | 476 | 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 | ['JavaScript'] | 0 |
counter | Absolutely one of the best solutions | absolutely-one-of-the-best-solutions-by-qyhhw | Code | roniahamed | NORMAL | 2024-12-22T05:59:54.339834+00:00 | 2024-12-22T05:59:54.339834+00:00 | 55 | false |
# Code
```javascript []
/**
* @param {number} n
* @return {Function} counter
*/
var createCounter = function(n) {
return function() {
return n++ ;
};
};
/**
* const counter = createCounter(10)
* counter() // 10
* counter() // 11
* counter() // 12
*/
``` | 1 | 0 | ['JavaScript'] | 0 |
counter | easy | easy-by-eczqplqdkg-frcn | IntuitionApproachComplexity
Time complexity:
Space complexity:
Code | ECZQpLqdKg | NORMAL | 2024-12-19T00:33:09.865588+00:00 | 2024-12-19T00:33:09.865588+00:00 | 100 | 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 | ['JavaScript'] | 0 |
counter | ☑️ Incrementing everytime function called. ☑️ | incrementing-everytime-function-called-b-8z1n | Code | Abdusalom_16 | NORMAL | 2024-12-16T05:44:31.232607+00:00 | 2024-12-16T05:44:31.232607+00:00 | 109 | false | # Code\n```javascript []\n/**\n * @param {number} n\n * @return {Function} counter\n */\nvar createCounter = function(n) {\n \n return function() {\n return n++;\n };\n};\n\n/** \n * const counter = createCounter(10)\n * counter() // 10\n * counter() // 11\n * counter() // 12\n */\n``` | 1 | 0 | ['JavaScript'] | 0 |
counter | Counter Function Using Closures in JavaScript | counter-function-using-closures-in-javas-g511 | Intuition\nThe problem involves generating a counter function that starts from a given integer n and increments its value each time the function is called. Usin | OmkarBhal | NORMAL | 2024-11-21T12:41:40.857865+00:00 | 2024-11-21T12:41:40.857902+00:00 | 221 | false | # Intuition\nThe problem involves generating a counter function that starts from a given integer n and increments its value each time the function is called. Using a closure is an ideal solution since closures allow functions to retain access to variables from their lexical scope, even after the outer function has exec... | 1 | 1 | ['JavaScript'] | 1 |
counter | One Liner💯💯 | one-liner-by-tanish-hrk-t1bc | Code\njavascript []\n/**\n * @param {number} n\n * @return {Function} counter\n */\nvar createCounter = function(n) {\n \n return function() {\n re | tanish-hrk | NORMAL | 2024-09-18T18:45:34.796046+00:00 | 2024-09-18T18:45:34.796081+00:00 | 56 | false | # Code\n```javascript []\n/**\n * @param {number} n\n * @return {Function} counter\n */\nvar createCounter = function(n) {\n \n return function() {\n return n++;\n };\n};\n\n/** \n * const counter = createCounter(10)\n * counter() // 10\n * counter() // 11\n * counter() // 12\n */\n``` | 1 | 0 | ['JavaScript'] | 1 |
counter | Simple Code🚀💯 || Easy to understand✅👍 | simple-code-easy-to-understand-by-jinees-bpia | \n# Approach\n Describe your approach to solving the problem. \n1.Closure:\n\n- The createCounter function returns an inner function that has access to the vari | jineesh_desai_09 | NORMAL | 2024-08-15T04:39:14.089685+00:00 | 2024-08-15T04:39:14.089718+00:00 | 107 | false | \n# Approach\n<!-- Describe your approach to solving the problem. -->\n**1.Closure:**\n\n- The createCounter function returns an inner function that has access to the variable n from its outer lexical scope.\n- Each time the returned function is called, it returns the current value of n and then increments n by 1.\n- T... | 1 | 0 | ['JavaScript'] | 0 |
counter | Counter w/ TypeScript | counter-with-typescript-by-skywalkersam-zp5n | null | skywalkerSam | NORMAL | 2024-07-26T18:11:55.981956+00:00 | 2025-02-05T14:29:42.510988+00:00 | 9 | false |
```
function createCounter(n: number): () => number {
return function() {
return n++;
}
}
/**
* const counter = createCounter(10)
* counter() // 10
* counter() // 11
* counter() // 12
*/
``` | 1 | 0 | ['TypeScript'] | 0 |
counter | JavaScript solution | javascript-solution-by-siyadhri-u8yp | \n\n# Code\n\n/**\n * @param {number} n\n * @return {Function} counter\n */\nvar createCounter = function(n) {\n \n return function() {\n return n++; | siyadhri | NORMAL | 2024-06-09T14:27:35.181970+00:00 | 2024-06-09T14:27:35.181999+00:00 | 2 | false | \n\n# Code\n```\n/**\n * @param {number} n\n * @return {Function} counter\n */\nvar createCounter = function(n) {\n \n return function() {\n return n++; \n };\n};\n\n/** \n * const counter = createCounter(10)\n * counter() // 10\n * counter() // 11\n * counter() // 12\n */\n``` | 1 | 0 | ['JavaScript'] | 0 |
counter | Closure Counter Without Increase | closure-counter-without-increase-by-isab-nax7 | 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 | isabellastor25 | NORMAL | 2024-06-01T02:39:46.853043+00:00 | 2024-06-01T02:39:46.853076+00:00 | 272 | 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 | ['JavaScript'] | 1 |
counter | Kind of Jank | kind-of-jank-by-localnerdcoder-c7ka | 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 | LocalNerdCoder | NORMAL | 2024-03-14T14:53:18.767731+00:00 | 2024-03-14T14:53:18.767755+00:00 | 486 | 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 | ['JavaScript'] | 1 |
counter | Q2 Sol. (Just for my record) | q2-sol-just-for-my-record-by-lonetwyl-zq71 | Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \nn = n + 1 \nWhen it cal | lonetwyl | NORMAL | 2024-02-27T09:31:54.198732+00:00 | 2024-02-27T09:31:54.198750+00:00 | 588 | false | # Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nn = n + 1 \nWhen it calls the function, the number should increase by 1.\nThe result shows that the function is called first time, it would be the original number. The... | 1 | 0 | ['JavaScript'] | 1 |
counter | very Easy code | very-easy-code-by-muhsin313-5lip | 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 | muhsin313 | NORMAL | 2024-02-27T01:52:36.012933+00:00 | 2024-02-27T01:52:36.012959+00:00 | 529 | 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 | ['JavaScript'] | 1 |
counter | 🚀 [ JS ] Solution | js-solution-by-maxi_s-c23v | 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 | maxi_s | NORMAL | 2024-02-26T16:19:57.406130+00:00 | 2024-02-26T16:19:57.406160+00:00 | 1,800 | 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 | ['JavaScript'] | 1 |
counter | [JS] Easy Solution | Clean Code | js-easy-solution-clean-code-by-lshigami-307r | 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 | lshigami | NORMAL | 2024-02-15T12:43:33.230000+00:00 | 2024-02-15T12:43:33.230033+00:00 | 854 | 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 | ['JavaScript'] | 1 |
counter | Easy solution | easy-solution-by-truongtamthanh2004-wtyc | 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 | truongtamthanh2004 | NORMAL | 2024-02-08T07:38:49.421842+00:00 | 2024-02-08T07:38:49.421875+00:00 | 555 | 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 | ['JavaScript'] | 1 |
counter | easy simple one liner code | easy-simple-one-liner-code-by-apophis29-85nv | Return an arrow function that +1 to n\n\n# Code\n\n/**\n * @param {number} n\n * @return {Function} counter\n */\nvar createCounter = function(n) {\n \n r | Apophis29 | NORMAL | 2024-01-12T15:51:18.697733+00:00 | 2024-01-12T15:51:18.697757+00:00 | 713 | false | Return an arrow function that +1 to n\n\n# Code\n```\n/**\n * @param {number} n\n * @return {Function} counter\n */\nvar createCounter = function(n) {\n \n return ()=>n++ \n \n };\n\n\n/** \n * const counter = createCounter(10)\n * counter() // 10\n * counter() // 11\n * counter() // 12\n */\n``` | 1 | 0 | ['JavaScript'] | 1 |
counter | One-liner simple solution | one-liner-simple-solution-by-shreya4dhin-2vye | Code\n\nlet createCounter = n => () => n++;\n | shreya4dhingra | NORMAL | 2023-12-02T07:15:17.601246+00:00 | 2023-12-02T07:15:17.601271+00:00 | 2 | false | # Code\n```\nlet createCounter = n => () => n++;\n``` | 1 | 0 | ['JavaScript'] | 1 |
counter | 2620. Counter: Easy Solution | 2620-counter-easy-solution-by-archana094-13xn | 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 | Archana0943 | NORMAL | 2023-10-30T16:51:18.459350+00:00 | 2023-10-30T16:51:18.459390+00:00 | 976 | 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 | ['JavaScript'] | 2 |
counter | Easy AF!! code | easy-af-code-by-ashirwad2573-m2cd | 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 | ashirwad2573 | NORMAL | 2023-08-30T04:56:09.636692+00:00 | 2023-08-30T04:56:09.636715+00:00 | 22 | 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 | ['JavaScript'] | 0 |
counter | Increment (++) operator solution | increment-operator-solution-by-user3087v-ijqc | Why the n++ operator works this way?\nIf used postfix, with operator after operand (for example, x++), the increment operator increments and returns the value b | user3087VQ | NORMAL | 2023-08-21T14:32:42.122172+00:00 | 2023-08-21T14:32:42.122192+00:00 | 3 | false | # Why the `n++` operator works this way?\nIf used postfix, with operator after operand (for example, `x++`), the increment operator increments and returns the value before incrementing.\n\nThat is why on the first call, the value of `n` is returned, and its value is incremented only after returning from the first call.... | 1 | 0 | ['JavaScript'] | 0 |
counter | Easy & Simple 🚀 | easy-simple-by-axatsachani-pacj | Code\n\n/**\n * @param {number} n\n * @return {Function} counter\n */\nvar createCounter = function (n) {\n return function () {\n n++\n return | AxatSachani | NORMAL | 2023-08-15T16:35:01.789577+00:00 | 2024-07-13T13:29:34.211034+00:00 | 13 | false | # Code\n```\n/**\n * @param {number} n\n * @return {Function} counter\n */\nvar createCounter = function (n) {\n return function () {\n n++\n return n - 1\n };\n};\n\n/** \n * const counter = createCounter(10)\n * counter() // 10\n * counter() // 11\n * counter() // 12\n */\n``` | 1 | 0 | ['JavaScript'] | 0 |
counter | DAY 2 of JS challenge⏳Beats 97%! 1 liner solution for beginners to understand🚀 | day-2-of-js-challengebeats-97-1-liner-so-v6oi | Intuition\nWe use an arrow function for the increment of n to take place\n# Code\n\n/**\n * @param {number} n\n * @return {Function} counter\n */\nvar createCou | deleted_user | NORMAL | 2023-05-27T06:27:49.714948+00:00 | 2023-05-27T13:34:14.322363+00:00 | 1,748 | false | # Intuition\nWe use an arrow function for the increment of n to take place\n# Code\n```\n/**\n * @param {number} n\n * @return {Function} counter\n */\nvar createCounter = function(n) {\n return ()=> n++\n};\n\n/** \n * const counter = createCounter(10)\n * counter() // 10\n * counter() // 11\n * counter() // 12\n *... | 1 | 0 | ['JavaScript'] | 1 |
counter | Closures || ONE line✅|| JS || EASY || Beats 96% 😎😎✅✅☑☑✔ | closures-one-line-js-easy-beats-96-by-lu-m0ww | \n\n# Code\n\n/**\n * @param {number} n\n * @return {Function} counter\n */\nvar createCounter = function(n) {\n return function() {\n return n++; \n | luffy233 | NORMAL | 2023-05-16T08:37:50.713238+00:00 | 2023-05-16T08:37:50.713280+00:00 | 474 | false | \n\n# Code\n```\n/**\n * @param {number} n\n * @return {Function} counter\n */\nvar createCounter = function(n) {\n return function() {\n return n++; \n };\n};\n\n/** \n * const counter = createCounter(10)\n * counter() // 10\n * counter() // 11\n * counter() // 12\n */\n``` | 1 | 0 | ['Python', 'C++', 'Java', 'JavaScript', 'Erlang'] | 0 |
counter | Easy and simple approach JAVASCRIPT | easy-and-simple-approach-javascript-by-k-dg3s | \n\n# Code\n\n/**\n * @param {number} n\n * @return {Function} counter\n */\n \nvar createCounter = function(n) {\n var num = n-1;\n return function() {\n | krish2213 | NORMAL | 2023-05-11T14:24:50.345477+00:00 | 2023-05-11T14:24:50.345515+00:00 | 9 | false | \n\n# Code\n```\n/**\n * @param {number} n\n * @return {Function} counter\n */\n \nvar createCounter = function(n) {\n var num = n-1;\n return function() {\n num+=1;\n return(num);\n };\n};\n\n/** \n * const counter = createCounter(10)\n * counter() // 10\n * counter() // 11\n * counter() // 12\n... | 1 | 0 | ['JavaScript'] | 0 |
counter | Very short solution TS | very-short-solution-ts-by-makarofalex-ajah | 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 | makarofalex | NORMAL | 2023-05-09T14:00:07.864893+00:00 | 2023-05-09T14:00:07.864931+00:00 | 120 | 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 | ['TypeScript'] | 0 |
counter | Easy One Line | easy-one-line-by-bekki3-t8gy | return n post-incremented\n\n# Code\n\n/**\n * @param {number} n\n * @return {Function} counter\n */\nvar createCounter = function(n) {\n return function() { | bekki3 | NORMAL | 2023-05-06T13:32:23.804052+00:00 | 2023-05-06T13:32:23.804088+00:00 | 530 | false | return n post-incremented\n\n# Code\n```\n/**\n * @param {number} n\n * @return {Function} counter\n */\nvar createCounter = function(n) {\n return function() {\n return n++\n };\n};\n\n/** \n * const counter = createCounter(10)\n * counter() // 10\n * counter() // 11\n * counter() // 12\n */\n``` | 1 | 0 | ['C', 'C++', 'Java', 'Python3', 'JavaScript'] | 0 |
counter | [ JavaScript ] ✅✅ Simple JavaScript Solution | Typescript 🥳✌👍 | javascript-simple-javascript-solution-ty-2y1f | If You like the Solution, Don\'t Forget To UpVote Me, Please UpVote! \uD83D\uDD3C\uD83D\uDE4F\n# Runtime: 69 ms, faster than 6.77% of JavaScript online submissi | ashok_kumar_meghvanshi | NORMAL | 2023-05-06T05:02:37.713585+00:00 | 2023-05-06T05:19:14.205166+00:00 | 44 | false | # If You like the Solution, Don\'t Forget To UpVote Me, Please UpVote! \uD83D\uDD3C\uD83D\uDE4F\n# Runtime: 69 ms, faster than 6.77% of JavaScript online submissions for Counter.\n# Memory Usage: 41.9 MB, less than 56.40% of JavaScript online submissions for Counter.\n\n\tvar createCounter = function(n) {\n\t\treturn f... | 1 | 0 | ['TypeScript', 'JavaScript'] | 0 |
counter | Day 2 => JS Challenge | day-2-js-challenge-by-divyanshu_singh_cs-5ssx | 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 | Divyanshu_singh_cs | NORMAL | 2023-05-06T03:59:49.071222+00:00 | 2023-05-06T03:59:49.071251+00:00 | 23 | 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 | ['JavaScript'] | 0 |
counter | ✌ Simple O(1) Solution ✌ | simple-o1-solution-by-silvermete0r-a7kv | Complexity\n- Time complexity:\nO(1)\n\n- Space complexity:\nO(1)\n\n# Code\nJavaScript []\nvar createCounter = function(n) {\n return function() {\n | silvermete0r | NORMAL | 2023-05-06T03:47:33.074938+00:00 | 2023-05-06T03:47:33.074981+00:00 | 7 | false | # Complexity\n- Time complexity:\n$$O(1)$$\n\n- Space complexity:\n$$O(1)$$\n\n# Code\n``` JavaScript []\nvar createCounter = function(n) {\n return function() {\n return n++;\n };\n};\n``` | 1 | 0 | ['JavaScript'] | 0 |
counter | Easy code beats 90% | easy-code-beats-90-by-adicoder95-gqvv | Code\n\n// Define a function that takes an initial value `n` and returns another function\nfunction createCounter(n) {\n // Return the counter function that us | AdiCoder95 | NORMAL | 2023-04-14T04:30:04.795097+00:00 | 2023-04-14T04:30:04.795140+00:00 | 1,098 | false | # Code\n```\n// Define a function that takes an initial value `n` and returns another function\nfunction createCounter(n) {\n // Return the counter function that uses the initial value `n` and increments it every time it is called\n return function counter() {\n let result = n; // Store the current value of `n` in... | 1 | 0 | ['JavaScript'] | 0 |
counter | Closure and Arrow function | closure-and-arrow-function-by-_kitish-r73d | Code\n\nconst createCounter = n => {\n let count = n, i = -1\n return () => count + ++i;\n};\n | _kitish | NORMAL | 2023-04-13T12:53:02.949213+00:00 | 2023-04-13T12:53:02.949262+00:00 | 5,392 | false | # Code\n```\nconst createCounter = n => {\n let count = n, i = -1\n return () => count + ++i;\n};\n``` | 1 | 0 | ['JavaScript'] | 1 |
counter | closure, inner function remembers the variable which is in it's birth scope | closure-inner-function-remembers-the-var-7a3x | here the inner function which is returned remembres the variable that was initialised in the function global scope that is the create counter function.\n\n# Cod | rajsiddi | NORMAL | 2023-04-12T07:09:20.865291+00:00 | 2023-04-15T15:44:45.900991+00:00 | 31 | false | here the inner function which is returned remembres the variable that was initialised in the function global scope that is the create counter function.\n\n# Code\n```\n/**\n * @param {number} n\n * @return {Function} counter\n */\nvar createCounter = function(n) {\n let temp = n-1;\n return function() {\n \... | 1 | 0 | ['JavaScript'] | 0 |
counter | JS Easy solution :- Closure | js-easy-solution-closure-by-siteshmehta-syu1 | Approach\nA closure has been utilized in our code. This enables the retention of variable values and function declarations even after the function has finished | siteshmehta | NORMAL | 2023-04-12T05:50:03.834696+00:00 | 2023-04-12T05:50:52.249880+00:00 | 39 | false | # Approach\nA closure has been utilized in our code. This enables the retention of variable values and function declarations even after the function has finished executing.\n\n\n\n\n\n\n# Code\n```\n/**\n * @param {number} n\n * @return {Function} counter\n */\nvar createCounter = function(n) {\n let counter = n; /... | 1 | 0 | ['JavaScript'] | 0 |
counter | ✅✅ JavaScript || TypeScript Solution || Begineer Friendly ✅✅ | javascript-typescript-solution-begineer-d0n5t | \n\n# Approach\n Describe your approach to solving the problem. \nWe are getting n in the parent function as an argument. We have to return n and increase it by | 0xsonu | NORMAL | 2023-04-12T04:02:39.872666+00:00 | 2023-04-12T04:02:39.872702+00:00 | 72 | false | \n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nWe are getting `n` in the parent function as an argument. We have to return n and increase it by one `n++`.\n\n# Code\n```TypeScript []\nfunction createCounter(n: number): () => number {\n return function() {\n return n++;\n }\n}\n\n\... | 1 | 0 | ['TypeScript', 'JavaScript'] | 1 |
counter | Simple and Clean JavaScript solution | simple-and-clean-javascript-solution-by-7t4gk | \n\n# Code\n\n/**\n * @param {number} n\n * @return {Function} counter\n */\nvar createCounter = function(n) {\n let count = n;\n return function() {\n | sid_py | NORMAL | 2023-04-12T01:39:04.461161+00:00 | 2023-04-12T01:39:04.461211+00:00 | 198 | false | \n\n# Code\n```\n/**\n * @param {number} n\n * @return {Function} counter\n */\nvar createCounter = function(n) {\n let count = n;\n return function() {\n count++;\n return count - 1;\n };\n};\n\n/** \n * const counter = createCounter(10)\n * counter() // 10\n * counter() // 11\n * counter() // 1... | 1 | 0 | ['JavaScript'] | 0 |
counter | another javascript | another-javascript-by-manminder11-wz5q | IntuitionApproachComplexity
Time complexity:
Space complexity:
Code | manminder11 | NORMAL | 2025-04-11T00:36:10.185265+00:00 | 2025-04-11T00:36:10.185265+00:00 | 1 | 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
`... | 0 | 0 | ['JavaScript'] | 0 |
longest-continuous-increasing-subsequence | [Java/C++]Clean solution | javacclean-solution-by-caihao0727mail-4rci | The idea is to use cnt to record the length of the current continuous increasing subsequence which ends with nums[i], and use res to record the maximum cnt.\n\n | caihao0727mail | NORMAL | 2017-09-10T03:16:27.752000+00:00 | 2018-08-26T23:44:47.535748+00:00 | 23,784 | false | The idea is to use ```cnt``` to record the length of the current continuous increasing subsequence which ends with ```nums[i]```, and use ```res``` to record the maximum ```cnt```.\n\nJava version:\n```\n public int findLengthOfLCIS(int[] nums) {\n int res = 0, cnt = 0;\n for(int i = 0; i < nums.length... | 79 | 2 | [] | 15 |
longest-continuous-increasing-subsequence | Python DP solution | python-dp-solution-by-shijungg-3web | \nclass Solution(object):\n def findLengthOfLCIS(self, nums):\n if not nums:\n return 0\n dp = [1] * len(nums)\n for i in ran | shijungg | NORMAL | 2018-11-28T12:22:14.895945+00:00 | 2018-11-28T12:22:14.896004+00:00 | 4,165 | false | ```\nclass Solution(object):\n def findLengthOfLCIS(self, nums):\n if not nums:\n return 0\n dp = [1] * len(nums)\n for i in range(1, len(nums)):\n if nums[i] > nums[i-1]:\n dp[i] = dp[i - 1] + 1\n return max(dp)\n``` | 49 | 2 | [] | 5 |
longest-continuous-increasing-subsequence | Python Simple Solution | python-simple-solution-by-yangshun-bhjs | A continuous subsequence is essentially a subarray. Hence this question is asking for the longest increasing subarray and I have no idea why the question calls | yangshun | NORMAL | 2017-09-10T03:07:07.805000+00:00 | 2022-03-14T03:17:55.136204+00:00 | 8,997 | false | A continuous subsequence is essentially a subarray. Hence this question is asking for the longest increasing subarray and I have no idea why the question calls it continuous subsequence to confuse the readers. \n\nAnyway, we can make one pass of the array and keep track of the current streak of increasing elements, res... | 32 | 1 | [] | 8 |
longest-continuous-increasing-subsequence | [C++] Simple solution | c-simple-solution-by-shubhambhatt-0aqy | Pls upvote if you find this helpful :)\nKeep the length of each increasing sequence in a variable and one global variable for updating it with all the lengths | shubhambhatt__ | NORMAL | 2020-06-04T08:39:30.889181+00:00 | 2020-06-04T08:39:30.889228+00:00 | 2,725 | false | ***Pls upvote if you find this helpful :)***\nKeep the length of each increasing sequence in a variable and one global variable for updating it with all the lengths of increasing sequences.\n```\nclass Solution {\npublic:\n int findLengthOfLCIS(vector<int>& nums) {\n if(nums.size()<=1)return nums.size();\n ... | 26 | 0 | ['C', 'C++'] | 1 |
longest-continuous-increasing-subsequence | Python O(n) Solution - O(1) Space Complexity | python-on-solution-o1-space-complexity-b-7mqd | \nclass Solution:\n def findLengthOfLCIS(self, nums: List[int]) -> int:\n if not nums:\n return 0\n \n cur_len = 1\n m | xorobotxo | NORMAL | 2020-03-10T14:41:48.794141+00:00 | 2020-03-10T14:41:48.794176+00:00 | 2,967 | false | ```\nclass Solution:\n def findLengthOfLCIS(self, nums: List[int]) -> int:\n if not nums:\n return 0\n \n cur_len = 1\n max_len = 1\n \n for i in range(1,len(nums)):\n if nums[i] > nums[i-1]:\n cur_len += 1\n else:\n ... | 21 | 0 | ['Python', 'Python3'] | 2 |
longest-continuous-increasing-subsequence | Java code---6 liner | java-code-6-liner-by-cbyitina-cvjy | \npublic int findLengthOfLCIS(int[] nums) {\n if(nums.length==0) return 0;\n int length=1,temp=1;\n for(int i=0; i<nums.length-1;i++) {\n | cbyitina | NORMAL | 2017-10-15T07:54:12.931000+00:00 | 2018-09-24T21:39:25.058046+00:00 | 5,441 | false | ```\npublic int findLengthOfLCIS(int[] nums) {\n if(nums.length==0) return 0;\n int length=1,temp=1;\n for(int i=0; i<nums.length-1;i++) {\n if(nums[i]<nums[i+1]) {temp++; length=Math.max(length,temp);}\n else temp=1; \n }\n return length;\n }\n``` | 21 | 2 | [] | 9 |
longest-continuous-increasing-subsequence | Java solution, DP | java-solution-dp-by-shawngao-xhrj | \nclass Solution {\n public int findLengthOfLCIS(int[] nums) {\n if (nums == null || nums.length == 0) return 0;\n int n = nums.length;\n | shawngao | NORMAL | 2017-09-10T03:14:20.426000+00:00 | 2018-10-02T22:57:03.991089+00:00 | 4,553 | false | ```\nclass Solution {\n public int findLengthOfLCIS(int[] nums) {\n if (nums == null || nums.length == 0) return 0;\n int n = nums.length;\n int[] dp = new int[n];\n \n int max = 1;\n dp[0] = 1;\n for (int i = 1; i < n; i++) {\n if (nums[i] > nums[i - 1]) {... | 20 | 6 | [] | 4 |
longest-continuous-increasing-subsequence | Easy c++ 2 lines | easy-c-2-lines-by-coderaky-bf0g | Always set r and c as 1 cause subsequence length can\'t be smaller than 1.\n\nint findLengthOfLCIS(vector<int>& nums) {\n int r=1,c=1;\n for(int i | coderaky | NORMAL | 2021-11-14T04:08:08.283585+00:00 | 2021-11-14T04:08:08.283618+00:00 | 873 | false | Always set r and c as 1 cause subsequence length can\'t be smaller than 1.\n```\nint findLengthOfLCIS(vector<int>& nums) {\n int r=1,c=1;\n for(int i=1;i<nums.size();i++)\n r=max(r,nums[i]>nums[i-1]?++c:c=1);\n return r;\n }\n``` | 15 | 0 | [] | 0 |
longest-continuous-increasing-subsequence | [C++/Java] Clean Code - 3 liner [2 Pointers] | cjava-clean-code-3-liner-2-pointers-by-a-rfdt | C++ record length\n\nclass Solution {\npublic:\n int findLengthOfLCIS(vector<int>& a) {\n int mx = 0, len = 0;\n for (int i = 0; i < a.size(); | alexander | NORMAL | 2017-09-10T03:21:27.015000+00:00 | 2018-10-02T20:33:08.492935+00:00 | 3,145 | false | **C++ record length**\n```\nclass Solution {\npublic:\n int findLengthOfLCIS(vector<int>& a) {\n int mx = 0, len = 0;\n for (int i = 0; i < a.size(); i++) {\n if (i == 0 || a[i] <= a[i - 1]) len = 0;\n mx = max(mx, ++len);\n }\n return mx;\n }\n};\n```\n**C++ 2 po... | 14 | 3 | [] | 1 |
longest-continuous-increasing-subsequence | Java | 100% faster | simple - O(n) time and O(1) space - simple and only few lines | java-100-faster-simple-on-time-and-o1-sp-5hct | \npublic int findLengthOfLCIS(int[] nums) \n{\n\tint maximum = 1;\n\tint currentMax = 1;\n\tfor(int i = 1; i < nums.length; i++)\n\t{\n\t\tcurrentMax = nums[i] | C0deHacker | NORMAL | 2020-12-20T21:21:16.873826+00:00 | 2020-12-20T21:21:16.873868+00:00 | 1,158 | false | ```\npublic int findLengthOfLCIS(int[] nums) \n{\n\tint maximum = 1;\n\tint currentMax = 1;\n\tfor(int i = 1; i < nums.length; i++)\n\t{\n\t\tcurrentMax = nums[i] > nums[i - 1] ? currentMax + 1 : 1; \n\t\tmaximum = Math.max(maximum, currentMax);\n\t}\n\n\treturn nums.length == 0 ? 0 : maximum;\n}\n``` | 8 | 0 | ['Java'] | 3 |
longest-continuous-increasing-subsequence | 1 ms Java Solution | 1-ms-java-solution-by-janhvi__28-xp98 | \nclass Solution {\n public int findLengthOfLCIS(int[] nums) {\n if(nums.length==0) return 0;\n int length=1,temp=1;\n for(int i=0; i<nu | Janhvi__28 | NORMAL | 2022-08-07T18:15:13.796383+00:00 | 2022-08-07T18:15:13.796413+00:00 | 1,154 | false | ```\nclass Solution {\n public int findLengthOfLCIS(int[] nums) {\n if(nums.length==0) return 0;\n int length=1,temp=1;\n for(int i=0; i<nums.length-1;i++) {\n if(nums[i]<nums[i+1]) {temp++; length=Math.max(length,temp);}\n else temp=1; \n }\n return length;\n... | 7 | 0 | [] | 0 |
longest-continuous-increasing-subsequence | JavaScript Clean 2 Sliding-Window Approaches | javascript-clean-2-sliding-window-approa-2q1c | Solution 1\n\n\nvar findLengthOfLCIS = function(nums) {\n let len = 1, maxLen = 0;\n \n for(let i = 0; i < nums.length; i++) {\n if(nums[i] < nu | control_the_narrative | NORMAL | 2020-06-04T17:19:21.125439+00:00 | 2020-06-04T17:24:10.279296+00:00 | 893 | false | ## Solution 1\n\n```\nvar findLengthOfLCIS = function(nums) {\n let len = 1, maxLen = 0;\n \n for(let i = 0; i < nums.length; i++) {\n if(nums[i] < nums[i+1]) len++;\n else len = 1;\n maxLen = Math.max(len, maxLen);\n }\n return maxLen; \n};\n```\n\n## Solution 2\n\n```javascript\nv... | 7 | 1 | ['Sliding Window', 'JavaScript'] | 2 |
longest-continuous-increasing-subsequence | Python 3 Three Solutions Using Stack and Sliding Window and DP | python-3-three-solutions-using-stack-and-xoju | Using Stack\npython\nclass Solution:\n def findLengthOfLCIS(self, nums: List[int]) -> int:\n if not nums:\n return 0\n if len(nums)= | deepak_goswami | NORMAL | 2020-03-16T12:16:33.089833+00:00 | 2020-03-16T12:16:55.342713+00:00 | 520 | false | **Using Stack**\n```python\nclass Solution:\n def findLengthOfLCIS(self, nums: List[int]) -> int:\n if not nums:\n return 0\n if len(nums)==1:\n return 1\n st = []\n max_len = float(\'-inf\')\n for i in range(len(nums)):\n if not st:\n ... | 7 | 1 | [] | 0 |
longest-continuous-increasing-subsequence | Simple Java ☕ Solution using 2 pointer approach | Time: Beats 100% of the Solutions ✅ | simple-java-solution-using-2-pointer-app-sh3t | Intuition\n Describe your first thoughts on how to solve this problem. \nWe are to find the longest continuous increasing subsequence(LCIS), for that, what I th | hetpatelcse | NORMAL | 2023-01-30T15:17:18.989145+00:00 | 2023-01-30T15:20:14.156711+00:00 | 1,563 | false | # Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nWe are to find the longest continuous increasing subsequence(LCIS), for that, what I thought was that, if we are checking the length from an element at any index, and if we reach a point that now our subsequence is not increasing, then we... | 6 | 0 | ['Two Pointers', 'Java'] | 1 |
longest-continuous-increasing-subsequence | Two python solutions using dp and a straightforward soln | two-python-solutions-using-dp-and-a-stra-03mn | DP solution.\nclass Solution:\n def findLengthOfLCIS(self, nums: List[int]) -> int:\n dp=[1]*len(nums)\n for i in range(1,len(nums)):\n | guneet100 | NORMAL | 2022-08-18T17:37:30.558682+00:00 | 2022-08-18T17:37:30.558720+00:00 | 1,323 | false | 1. DP solution.\n```class Solution:\n def findLengthOfLCIS(self, nums: List[int]) -> int:\n dp=[1]*len(nums)\n for i in range(1,len(nums)):\n if nums[i]>nums[i-1]:\n dp[i]+=dp[i-1]\n return max(dp)\n ```\n2\n```\nclass Solution:\n def findLengthOfLCIS(self, nums: Lis... | 6 | 0 | ['Python', 'Python3'] | 3 |
longest-continuous-increasing-subsequence | 674: Solution with step by step explanation | 674-solution-with-step-by-step-explanati-kjn2 | Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n1. We handle the base cases where the input list is empty or has only one | Marlen09 | NORMAL | 2023-03-19T18:04:01.823554+00:00 | 2023-03-19T18:04:01.823599+00:00 | 874 | false | # Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n1. We handle the base cases where the input list is empty or has only one element. In both cases, the length of the longest continuous in1.creasing subsequence is the length of the input list itself, so we simply return that... | 5 | 0 | ['Array', 'Python', 'Python3'] | 0 |
longest-continuous-increasing-subsequence | Python Easy Solution without Sliding Window, O(n), 54ms, beats 93.23% with Explanation | python-easy-solution-without-sliding-win-0i8l | Explanation\n1. Edge case if there is only one element in nums\n2. add a counter and a max counter (in case the maximum is at beginning)\n3. iterate through num | alexl5311 | NORMAL | 2022-05-07T04:00:20.616319+00:00 | 2022-05-07T04:35:18.187564+00:00 | 520 | false | **Explanation**\n1. Edge case if there is only one element in nums\n2. add a counter and a max counter (in case the maximum is at beginning)\n3. iterate through nums:\n\t4. if it\'s the first element, continue (no previous, will evoke error)\n\t5. each time the element is greater than the previous one (increasing), add... | 5 | 0 | ['Python'] | 0 |
longest-continuous-increasing-subsequence | Easy Approach || Python3 | easy-approach-python3-by-harxsan-gc06 | Approach\n Simple Intuition\n# Complexity\n- Time complexity:\n O(N)\n- Space complexity:\n O(1)\n# Code\npython3 []\nclass Solution:\n def findLeng | harxsan | NORMAL | 2024-08-29T09:18:37.676851+00:00 | 2024-08-29T09:18:37.676890+00:00 | 521 | false | # Approach\n Simple Intuition\n# Complexity\n- Time complexity:\n O(N)\n- Space complexity:\n O(1)\n# Code\n```python3 []\nclass Solution:\n def findLengthOfLCIS(self, nums: List[int]) -> int:\n cnt = 1\n max_cnt = 0\n if len(nums) == 1:\n return 1\n for i in range(1,l... | 4 | 0 | ['Python3'] | 1 |
longest-continuous-increasing-subsequence | simple and easy understand solution | simple-and-easy-understand-solution-by-s-fdi6 | if it\'s help, please up \u2B06 vote! \u2764\uFE0F\n\n\n# Code\n\nclass Solution {\npublic:\n int findLengthOfLCIS(vector<int>& nums) \n {\n int mx | shishirRsiam | NORMAL | 2024-04-07T03:57:07.459715+00:00 | 2024-04-07T03:57:07.459743+00:00 | 1,137 | false | # if it\'s help, please up \u2B06 vote! \u2764\uFE0F\n\n\n# Code\n```\nclass Solution {\npublic:\n int findLengthOfLCIS(vector<int>& nums) \n {\n int mx = 1, cur = 1, n = nums.size();\n for(int i=1;i<n;i++)\n {\n if(nums[i] > nums[i-1]) cur++;\n else \n {\n ... | 4 | 1 | ['Array', 'C', 'C++', 'Java', 'C#'] | 3 |
longest-continuous-increasing-subsequence | 🔥Beats 99.71%🔥✅Easy (Java/C++/Python) Solution With Detailed Explanation✅ | beats-9971easy-javacpython-solution-with-jno5 | Intuition\nThe method findLengthOfLCIS employs a single pass through the array to identify and measure the lengths of continuous increasing subsequences, updati | suyogshete04 | NORMAL | 2024-01-26T04:48:52.833857+00:00 | 2024-01-26T04:48:52.833894+00:00 | 1,365 | false | # Intuition\nThe method `findLengthOfLCIS` employs a single pass through the array to identify and measure the lengths of continuous increasing subsequences, updating a count for each subsequence. It maintains and updates the maximum length (`ans`) of these subsequences encountered so far. Whenever a non-increasing pai... | 3 | 0 | ['C++', 'Java', 'Python3'] | 0 |
longest-continuous-increasing-subsequence | Beginners Python Code | beginners-python-code-by-geethika1829-f7l6 | Code\n\nclass Solution:\n def findLengthOfLCIS(self, nums: List[int]) -> int:\n n = len(nums)\n ans = 1\n curr_len = 1\n for i in | geethika1829 | NORMAL | 2023-09-05T05:48:18.066665+00:00 | 2023-09-05T05:48:18.066698+00:00 | 418 | false | # Code\n```\nclass Solution:\n def findLengthOfLCIS(self, nums: List[int]) -> int:\n n = len(nums)\n ans = 1\n curr_len = 1\n for i in range(1,n):\n if nums[i] > nums[i-1]:\n curr_len = curr_len + 1\n ans = max(ans,curr_len)\n else:\n ... | 3 | 0 | ['Python3'] | 1 |
longest-continuous-increasing-subsequence | Very easy and simple solution in JavaScript!!! WoW. Just watch it. :) | very-easy-and-simple-solution-in-javascr-oiem | \n# Code\n\n/**\n * @param {number[]} nums\n * @return {number}\n */\nvar findLengthOfLCIS = function(nums) {\n let max = 0, curr = 0\n for(let i = 0 ; i | AzamatAbduvohidov | NORMAL | 2023-05-13T13:51:12.905377+00:00 | 2023-05-13T13:51:12.905428+00:00 | 592 | false | \n# Code\n```\n/**\n * @param {number[]} nums\n * @return {number}\n */\nvar findLengthOfLCIS = function(nums) {\n let max = 0, curr = 0\n for(let i = 0 ; i < nums.length; i++) {\n if(nums[i] < nums[i + 1]) {\n curr++\n max = Math.max(max, curr)\n } else {\n curr = 0... | 3 | 0 | ['JavaScript'] | 0 |
longest-continuous-increasing-subsequence | C++ Easy Solution | c-easy-solution-by-anandmohit852-kjo7 | \n\n# Code\n\nclass Solution {\npublic:\n int findLengthOfLCIS(vector<int>& nums) {\n int maxi=1;\n int c=1;\n for(int i=0;i<nums.size() | anandmohit852 | NORMAL | 2023-02-17T14:00:31.389354+00:00 | 2023-02-17T14:00:31.389424+00:00 | 647 | false | \n\n# Code\n```\nclass Solution {\npublic:\n int findLengthOfLCIS(vector<int>& nums) {\n int maxi=1;\n int c=1;\n for(int i=0;i<nums.size()-1;i++){\n if(nums[i]<nums[i+1]){\n c++;\n }\n else{\n c=1;\n }\n if(max... | 3 | 0 | ['C++'] | 0 |
longest-continuous-increasing-subsequence | JS faster than 100% O(n) | js-faster-than-100-on-by-kunkka1996-7c8c | \n\n\nvar findLengthOfLCIS = function(nums) {\n let output = 0;\n let count = 0;\n\n for (let i = 0; i < nums.length; i++) {\n if (!count || num | kunkka1996 | NORMAL | 2022-08-27T03:10:01.906523+00:00 | 2022-08-27T03:10:01.906564+00:00 | 663 | false | \n\n```\nvar findLengthOfLCIS = function(nums) {\n let output = 0;\n let count = 0;\n\n for (let i = 0; i < nums.length; i++) {\n if (!count || nums[i] > nums[i - 1]) {\n count++;\n ... | 3 | 0 | ['JavaScript'] | 2 |
longest-continuous-increasing-subsequence | Easy Java Solution || 1ms & faster than 100% | easy-java-solution-1ms-faster-than-100-b-p4l0 | \nclass Solution {\n public int findLengthOfLCIS(int[] nums) {\n int max = 1;\n int count = 1;\n \n for(int i = 1 ; i < nums.leng | vmanishk | NORMAL | 2022-08-09T12:07:06.074277+00:00 | 2022-08-09T12:07:06.074330+00:00 | 493 | false | ```\nclass Solution {\n public int findLengthOfLCIS(int[] nums) {\n int max = 1;\n int count = 1;\n \n for(int i = 1 ; i < nums.length; i++) {\n if (nums[i - 1] < nums[i]) {\n count++;\n } else {\n count = 1;\n }\n ... | 3 | 0 | ['Java'] | 0 |
longest-continuous-increasing-subsequence | Python O(n) greedy | python-on-greedy-by-ypmagic2-2z9i | \ndef findLengthOfLCIS(self, nums: List[int]) -> int:\n max_length = 0\n cur_length = 0\n cur_max = float(\'-inf\')\n for num in num | ypmagic2 | NORMAL | 2020-07-24T06:44:00.413776+00:00 | 2020-07-24T06:44:00.413837+00:00 | 372 | false | ```\ndef findLengthOfLCIS(self, nums: List[int]) -> int:\n max_length = 0\n cur_length = 0\n cur_max = float(\'-inf\')\n for num in nums:\n if num > cur_max:\n cur_length += 1\n cur_max = num\n else:\n max_length = max(max_le... | 3 | 0 | ['Greedy', 'Python'] | 1 |
longest-continuous-increasing-subsequence | Javascript O(n) | javascript-on-by-fbecker11-8ep8 | \n/**\n * @param {number[]} nums\n * @return {number}\n */\nvar findLengthOfLCIS = function(nums) {\n let max = 0;\n let curr = 0;\n let prev = -Infinity;\n | fbecker11 | NORMAL | 2020-07-02T01:51:02.779448+00:00 | 2020-07-02T01:51:02.779486+00:00 | 289 | false | ```\n/**\n * @param {number[]} nums\n * @return {number}\n */\nvar findLengthOfLCIS = function(nums) {\n let max = 0;\n let curr = 0;\n let prev = -Infinity;\n for (let n of nums){\n if(n > prev){\n max = Math.max(max, ++curr) \n }else{\n curr = 1;\n }\n prev = n\n }\n return max\n};\n`... | 3 | 0 | ['JavaScript'] | 1 |
longest-continuous-increasing-subsequence | Straight-forward and fast Python | straight-forward-and-fast-python-by-he00-n7f4 | ```\nclass Solution(object):\n def findLengthOfLCIS(self, nums):\n """\n :type nums: List[int]\n :rtype: int\n """\n if le | he000193 | NORMAL | 2019-11-18T19:21:13.665534+00:00 | 2019-11-18T19:21:13.665588+00:00 | 355 | false | ```\nclass Solution(object):\n def findLengthOfLCIS(self, nums):\n """\n :type nums: List[int]\n :rtype: int\n """\n if len(nums) < 2:\n return len(nums)\n tmp, max_l = 1, 0\n for i in range(len(nums) - 1): \n if nums[i] < nums[i + 1]:\n ... | 3 | 0 | ['Python'] | 0 |
longest-continuous-increasing-subsequence | dp is powerfull | dp-is-powerfull-by-lin2017gg-gta9 | \nclass Solution {\n public int findLengthOfLCIS(int[] nums) {\n if(nums.length == 0) return 0;\n int[] dp = new int[nums.length];\n dp[ | lin2017gg | NORMAL | 2018-04-20T00:02:26.938086+00:00 | 2018-04-20T00:02:26.938086+00:00 | 296 | false | ```\nclass Solution {\n public int findLengthOfLCIS(int[] nums) {\n if(nums.length == 0) return 0;\n int[] dp = new int[nums.length];\n dp[0] = 1;\n for(int i = 1;i < nums.length;++i) {\n if(nums[i] > nums[i - 1]) {\n dp[i] = dp[i - 1] + 1;\n } else {\... | 3 | 1 | [] | 0 |
longest-continuous-increasing-subsequence | JAVA ✅|| BEGINNER FRIENDLY 🧠|| 100% BEATS 🚀 | java-beginner-friendly-100-beats-by-gopa-vivn | IntuitionWe need to find the longest continuous increasing subsequence (LCIS) in a given array. The idea is to keep track of how long the current increasing sub | GopalDev | NORMAL | 2025-02-13T03:35:04.188071+00:00 | 2025-02-13T03:35:04.188071+00:00 | 160 | false | ### Intuition
We need to find the longest continuous increasing subsequence (LCIS) in a given array. The idea is to keep track of how long the current increasing subsequence is while iterating through the array. If the current element is smaller than the next one, the subsequence continues. If not, the sequence ends, ... | 2 | 0 | ['Java'] | 0 |
longest-continuous-increasing-subsequence | Beginner's logic (0 ms) | beginners-logic-0-ms-by-dinhvanphuc-1f3z | IntuitionApproachUse max function to find max length when encounter a smaller number, remember that the initial value of count is always 1 because we are compar | DinhVanPhuc | NORMAL | 2025-01-09T07:52:17.945653+00:00 | 2025-01-09T07:52:17.945653+00:00 | 241 | false | # Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
# Approach
<!-- Describe your approach to solving the problem. -->
Use max function to find max length when encounter a smaller number, remember that the initial value of count is always 1 because we are comparing the number after, not the... | 2 | 0 | ['C++'] | 0 |
longest-continuous-increasing-subsequence | 1ms 99.95% in java very easy code | 1ms-9995-in-java-very-easy-code-by-galan-bz25 | Code | Galani_jenis | NORMAL | 2024-12-19T13:45:29.758271+00:00 | 2024-12-19T13:45:29.758271+00:00 | 377 | false | 
# Code
```java []
class Solution {
public int findLengthOfLCIS(int[] nums) {
int ans = -1;
int count = 1;
for (int i = 0; i <... | 2 | 0 | ['Java'] | 0 |
longest-continuous-increasing-subsequence | 674. Longest Continuous Increasing Subsequence | 674-longest-continuous-increasing-subseq-iq2m | Intuition\n Describe your first thoughts on how to solve this problem. \nSo it is so simple naive approach which make you so clear and understand\n# Approach\n | saumyap271 | NORMAL | 2024-12-08T02:37:04.837017+00:00 | 2024-12-08T02:37:04.837042+00:00 | 156 | false | # Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nSo it is so simple naive approach which make you so clear and understand\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- ... | 2 | 0 | ['C++'] | 0 |
longest-continuous-increasing-subsequence | Beats 100% | beats-100-by-sahilsaw-4u6h | Intuition\n Describe your first thoughts on how to solve this problem. \nGoing forward, keep track of how many values satisfy the condition arr[i] > arr[i+1]. T | SahilSaw | NORMAL | 2024-10-05T19:05:56.116255+00:00 | 2024-10-05T19:05:56.116273+00:00 | 68 | false | # Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nGoing forward, keep track of how many values satisfy the condition arr[i] > arr[i+1]. The moment this condition breaks, reset your count and store the maximum value in a variable. Print it at the end.\n# Approach\n<!-- Describe your appro... | 2 | 0 | ['C++'] | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.