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
sum-of-prefix-scores-of-strings
Solution By Dare2Solve | Detailed Explanation | Clean Code
solution-by-dare2solve-detailed-explanat-gxhd
Exlanation []\nauthorslog.com/blog/FxtvdgRwjW\n\n# Code\n\ncpp []\nclass TrieNode {\npublic:\n unordered_map<char, TrieNode*> children;\n int prefixCount;
Dare2Solve
NORMAL
2024-09-25T06:51:42.615867+00:00
2024-09-25T06:51:42.615900+00:00
787
false
```Exlanation []\nauthorslog.com/blog/FxtvdgRwjW\n```\n# Code\n\n```cpp []\nclass TrieNode {\npublic:\n unordered_map<char, TrieNode*> children;\n int prefixCount;\n \n TrieNode() {\n prefixCount = 0;\n }\n};\n\nclass Trie {\npublic:\n TrieNode* root;\n \n Trie() {\n root = new Tri...
4
0
['String', 'Trie', 'Python', 'C++', 'Java', 'Python3', 'JavaScript']
0
sum-of-prefix-scores-of-strings
C++ || Easy Tries Implementation ✅✅ || Beats 82.29%
c-easy-tries-implementation-beats-8229-b-67ym
Intuition\nThe problem requires calculating prefix scores for a list of words. The prefix score of a word is defined as the sum of the counts of occurrences of
arunk_leetcode
NORMAL
2024-09-25T05:52:44.613774+00:00
2024-09-25T05:52:44.613804+00:00
288
false
# Intuition\nThe problem requires calculating prefix scores for a list of words. The prefix score of a word is defined as the sum of the counts of occurrences of all its prefixes in a trie structure. The trie allows efficient insertion and retrieval of prefix counts, making it a suitable data structure for this task.\n...
4
0
['String', 'Trie', 'C++']
0
sum-of-prefix-scores-of-strings
simple and easy Python solution || Trie
simple-and-easy-python-solution-trie-by-ypbpa
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: ww
shishirRsiam
NORMAL
2024-09-25T05:05:59.695746+00:00
2024-09-25T05:05:59.695776+00:00
368
false
# 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\n\n# Complexity\n- Time complexity: O(n * l)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n\n# Code\n```python3 []\nclas...
4
0
['Array', 'String', 'Trie', 'Counting', 'Python', 'Python3']
7
sum-of-prefix-scores-of-strings
Simple Solution Using Trie Data Structure | Java
simple-solution-using-trie-data-structur-rj75
\n# Code\njava []\nclass Trie {\n Trie[] arr = new Trie[26];\n int count = 0;\n}\nclass Solution {\n\n Trie root = new Trie();\n\n void add_word(Str
eshwaraprasad
NORMAL
2024-09-25T04:59:02.526614+00:00
2024-09-25T04:59:02.526647+00:00
247
false
\n# Code\n```java []\nclass Trie {\n Trie[] arr = new Trie[26];\n int count = 0;\n}\nclass Solution {\n\n Trie root = new Trie();\n\n void add_word(String str) {\n Trie curr = root;\n int ind;\n for(char ch : str.toCharArray()) {\n ind = ch - \'a\';\n if(curr.arr[i...
4
0
['Java']
0
sum-of-prefix-scores-of-strings
simple and easy C++ solution || Trie
simple-and-easy-c-solution-trie-by-shish-dfqt
\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-25T04:54:03.126625+00:00
2024-09-25T04:54:03.126665+00:00
514
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# Complexity\n- Time complexity: O(n * l)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```cpp []\nclass TrieNo...
4
0
['Array', 'String', 'Trie', 'Counting', 'C++']
6
sum-of-prefix-scores-of-strings
2 Approaches || Trie & Hashing
2-approaches-trie-hashing-by-imdotrahul-z4up
Intuition\n Describe your first thoughts on how to solve this problem. \nTrie:\nTrie approach leverages the tree structure to store and count the frequency of e
imdotrahul
NORMAL
2024-09-25T03:35:42.553575+00:00
2024-09-25T03:35:42.553617+00:00
393
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n**Trie:**\nTrie approach leverages the tree structure to store and count the frequency of each prefix. Each node in the Trie represents a prefix formed by the characters from the root to that node. As words are inserted into the Trie, we ...
4
0
['Array', 'Hash Table', 'String', 'Trie', 'Counting', 'C++']
0
sum-of-prefix-scores-of-strings
All solutions
all-solutions-by-dixon_n-t85c
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
Dixon_N
NORMAL
2024-09-25T03:01:15.368206+00:00
2024-09-25T03:11:57.990356+00:00
28
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)$$ --...
4
0
['Java']
4
sum-of-prefix-scores-of-strings
Sum of Prefix Scores of Strings || DCC 25/09/24 || Trie Solution ✅✅
sum-of-prefix-scores-of-strings-dcc-2509-d1sz
Intuition\nThe problem revolves around finding the sum of scores for all prefixes of each word in the list. A Trie (prefix tree) is particularly suited for this
Ayush_Singh2004
NORMAL
2024-09-25T02:36:02.165959+00:00
2024-09-25T02:36:02.165991+00:00
161
false
# Intuition\nThe problem revolves around finding the sum of scores for all prefixes of each word in the list. A Trie (prefix tree) is particularly suited for this task, as it efficiently stores and retrieves prefixes of words. By traversing the Trie, we can track how many times each prefix appears, which allows us to c...
4
0
['Array', 'Trie', 'C++']
0
sum-of-prefix-scores-of-strings
Trie, just 3 steps
trie-just-3-steps-by-raviteja_29-v20w
Intuition\n Describe your first thoughts on how to solve this problem. \nTo solve this problem, you need to efficiently calculate the number of times each prefi
raviteja_29
NORMAL
2024-07-24T17:12:09.056160+00:00
2024-07-24T17:12:09.056191+00:00
176
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nTo solve this problem, you need to efficiently calculate the number of times each prefix of a given string appears in the list of words. A direct approach could involve checking each prefix of each string against all words, but this would...
4
0
['Python3']
2
sum-of-prefix-scores-of-strings
c++ two solution trie || hashing
c-two-solution-trie-hashing-by-dilipsuth-ylai
\nclass Solution\n{\n public:\n struct node\n {\n node *child[26] = { NULL\n };\n int count = 0;\n };\n
dilipsuthar17
NORMAL
2022-09-18T04:01:48.861504+00:00
2022-09-18T07:00:46.630347+00:00
361
false
```\nclass Solution\n{\n public:\n struct node\n {\n node *child[26] = { NULL\n };\n int count = 0;\n };\n node *root = new node();\n void insert(string & s)\n {\n int n = s.size();\n node *curr = root;\n for (int i = 0; i < n; i++)\...
4
0
['Trie', 'C', 'C++']
0
sum-of-prefix-scores-of-strings
Trie || striver Templete
trie-striver-templete-by-mayank670-hene
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
Mayank670
NORMAL
2024-09-25T13:25:25.359060+00:00
2024-09-25T13:25:25.359082+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)$$ --...
3
0
['String', 'Trie', 'C++']
0
sum-of-prefix-scores-of-strings
JAVA | Trie Data Structure
java-trie-data-structure-by-sudhikshagha-q9dl
Code\njava []\nclass TrieNode {\n TrieNode [] children = new TrieNode[26];\n int count = 0;\n}\nclass Solution {\n TrieNode root = new TrieNode();\n
SudhikshaGhanathe
NORMAL
2024-09-25T12:57:31.022161+00:00
2024-09-25T12:57:31.022197+00:00
24
false
# Code\n```java []\nclass TrieNode {\n TrieNode [] children = new TrieNode[26];\n int count = 0;\n}\nclass Solution {\n TrieNode root = new TrieNode();\n public void add(String word) {\n TrieNode curr = root;\n for (char c : word.toCharArray()) {\n int idx = c - \'a\';\n ...
3
0
['Trie', 'Counting', 'Java']
0
sum-of-prefix-scores-of-strings
[EASY] Simplified explantion of logic (using Trie Data Structure):
easy-simplified-explantion-of-logic-usin-h15g
Intuition\nThe problem asks us to compute the sum of prefix scores for each word in the given list. A prefix score is the total number of words in the list that
rinsane
NORMAL
2024-09-25T11:25:27.674667+00:00
2024-09-25T11:25:27.674700+00:00
40
false
# Intuition\nThe problem asks us to compute the sum of prefix scores for each word in the given list. A prefix score is the total number of words in the list that share the same prefix, up to every letter in the word.\n\nTo efficiently solve this problem, we can leverage a **Trie** (prefix tree). Tries are well-suited ...
3
0
['Trie', 'Python3']
1
sum-of-prefix-scores-of-strings
Sum of Prefix Scores of Strings
sum-of-prefix-scores-of-strings-by-pushp-viai
\n# Approach\n Describe your approach to solving the problem. \nHashMap and Trie\n\n\n\n# Time complexity:\n Add your time complexity here, e.g. O(n) \n- Hashma
Pushparaj_Shetty
NORMAL
2024-09-25T05:41:08.626147+00:00
2024-09-25T05:41:08.626186+00:00
89
false
\n# Approach\n<!-- Describe your approach to solving the problem. -->\n**HashMap** and **Trie**\n\n\n\n# Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n- **Hashmap**: O(n * k\xB2)\n \n\n- **Trie**: O(n * k)\n\n\n\n# Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\...
3
0
['Trie', 'Counting', 'Python3']
1
sum-of-prefix-scores-of-strings
Easy Solution | Explained with Example & Visual Walkthrough | Beginner Friendly |
easy-solution-explained-with-example-vis-iw3s
Approach\nBuilding the Trie:\nEvery time a letter is inserted into the Trie, we update the count for that letter\u2019s node. This count keeps track of how many
Guna01
NORMAL
2024-09-25T01:56:07.257494+00:00
2024-09-25T01:57:35.709746+00:00
93
false
# Approach\nBuilding the Trie:\nEvery time a letter is inserted into the Trie, we update the count for that letter\u2019s node. This count keeps track of how many words pass through that node.\n\nExample Words: ["abc", "ab", "bc", "b"]\n\nInsert "abc":\n\'a\' goes into the Trie (count is now 1).\n\'b\' goes into the Tr...
3
0
['Array', 'String', 'Trie', 'Counting', 'Java']
0
sum-of-prefix-scores-of-strings
Rust Solution
rust-solution-by-evanchun-txf6
Intuition\n\n# Approach\n\n# Complexity\n- Time complexity: O(n)\n\n- Space complexity: O(n)\n\n# Code\n\n#[derive(Default)]\nstruct Trie {\n cnt: usize,\n
evanchun
NORMAL
2024-06-05T06:39:39.949211+00:00
2024-06-05T06:39:39.949240+00:00
47
false
# Intuition\n\n# Approach\n\n# Complexity\n- Time complexity: O(n)\n\n- Space complexity: O(n)\n\n# Code\n```\n#[derive(Default)]\nstruct Trie {\n cnt: usize,\n children: [Option<Box<Trie>>; 27],\n}\n\nimpl Solution {\n pub fn sum_prefix_scores(words: Vec<String>) -> Vec<i32> {\n let mut root = Trie::de...
3
0
['Rust']
0
sum-of-prefix-scores-of-strings
[Python3] Trie - Simple Solution + Detailed Explanation
python3-trie-simple-solution-detailed-ex-rylt
Intuition\n Describe your first thoughts on how to solve this problem. \n- Check for Common Prefix for string -> Trie\n\n# Approach\n Describe your approach to
dolong2110
NORMAL
2024-02-18T10:37:47.966641+00:00
2024-09-25T07:24:31.004457+00:00
143
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n- Check for Common Prefix for string -> Trie\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n**1. Node Class:**\n\n- Represents a node in the Trie data structure.\n- `cnt_prf` stores the count of prefixes that en...
3
0
['String', 'Trie', 'Counting', 'Python3']
0
sum-of-prefix-scores-of-strings
C++ || EASY || TRIE
c-easy-trie-by-ganeshkumawat8740-em2l
Code\n\nclass trie{\n public:\n int x;\n trie *v[26];\n};\nvoid maketrie(string str,trie* node){\n for(auto &i: str){\n if(node->v[i-
ganeshkumawat8740
NORMAL
2023-05-26T09:10:27.874682+00:00
2023-05-26T09:10:27.874711+00:00
1,373
false
# Code\n```\nclass trie{\n public:\n int x;\n trie *v[26];\n};\nvoid maketrie(string str,trie* node){\n for(auto &i: str){\n if(node->v[i-\'a\'] == NULL){\n node->v[i-\'a\'] = new trie();\n node = node->v[i-\'a\'];\n node->x = node->x +1 ;\n }else{\n ...
3
0
['Array', 'String', 'Trie', 'Counting', 'C++']
0
sum-of-prefix-scores-of-strings
C++ || TRIE || EASY TO UNDERSTAND || SHORT & SWEET CODE
c-trie-easy-to-understand-short-sweet-co-35ai
\nclass trie{//make trie class\n public:\n int cnt;\n trie* v[26];\n trie(){\n cnt = 0;//no of common prefix\n for
yash___sharma_
NORMAL
2023-04-12T12:57:32.046538+00:00
2023-04-12T12:59:16.023159+00:00
205
false
````\nclass trie{//make trie class\n public:\n int cnt;\n trie* v[26];\n trie(){\n cnt = 0;//no of common prefix\n for(int i = 0; i < 26; i++){\n v[i] = NULL;\n }\n }\n};\nclass Solution {\npublic:\n vector<int> sumPrefixScores(vector<str...
3
0
['Trie', 'C', 'C++']
0
sum-of-prefix-scores-of-strings
C++ Fully optimized Trie 99% faster 87% less memory
c-fully-optimized-trie-99-faster-87-less-3ykr
This is based on the Trie approach but with significantly less memory usage.\nMy original Trie was 779 ms\t700.9 MB\nThis one is 353 ms\t186.5 MB\nhttps://leetc
flowac
NORMAL
2022-10-17T07:10:06.129557+00:00
2022-10-17T07:10:06.129592+00:00
369
false
This is based on the Trie approach but with significantly less memory usage.\nMy original Trie was 779 ms\t700.9 MB\nThis one is 353 ms\t186.5 MB\nhttps://leetcode.com/submissions/detail/824255922/\n\nI don\'t remember what this method is called. Please comment if you know the name.\n\nTake "abcd", "abef" for example:\...
3
0
['C', 'C++']
1
sum-of-prefix-scores-of-strings
[Javascript] get rid of memory allocation problem
javascript-get-rid-of-memory-allocation-36ybg
I found that in javascript, you will face memory problem in some testcase\nSo i\'m posting my solution here\n\nyou have to know that words with different inital
haocherhong
NORMAL
2022-09-19T16:13:03.051066+00:00
2022-09-19T16:13:03.051115+00:00
154
false
I found that in javascript, you will face memory problem in some testcase\nSo i\'m posting my solution here\n\nyou have to know that words with different inital characters wont affect each others\' score\nfor example, `abcd, aaab, acab` wont affect the scores of `cbcd, bacd, bbab, ccccd`.\nKnowing the fact, you know yo...
3
0
[]
2
sum-of-prefix-scores-of-strings
C++ Rabin Karp Algorithm || Easy Implementation
c-rabin-karp-algorithm-easy-implementati-e443
\ntypedef long long ll;\nclass Solution {\npublic:\n ll mod = 100000000007;\n ll dp[1005],pa[1005];\n void preProcess(string s){\n ll p = 29; /
manavmajithia6
NORMAL
2022-09-19T03:18:40.755823+00:00
2022-09-19T03:18:40.755956+00:00
98
false
```\ntypedef long long ll;\nclass Solution {\npublic:\n ll mod = 100000000007;\n ll dp[1005],pa[1005];\n void preProcess(string s){\n ll p = 29; // any prime no.\n ll pow = p;\n\n dp[0] = s[0] - \'a\' + 1;\n pa[0] = 1;\n for(ll i = 1;i < s.length();i++){\n dp[i] =...
3
0
['Dynamic Programming', 'C']
0
sum-of-prefix-scores-of-strings
Easy with Trie
easy-with-trie-by-deleted_user-m2h4
\nclass TrieNode{\n constructor(){\n this.ch = {};\n this.score = 0;\n }\n}\n\nclass Trie{\n constructor(){\n this.root = new TrieNode();\n }\n ad
deleted_user
NORMAL
2022-09-18T16:46:30.724748+00:00
2022-09-18T16:46:30.724794+00:00
166
false
```\nclass TrieNode{\n constructor(){\n this.ch = {};\n this.score = 0;\n }\n}\n\nclass Trie{\n constructor(){\n this.root = new TrieNode();\n }\n add(word){\n let cur = this.root;\n for(let c of word){\n if (!cur.ch.hasOwnProperty(c)){\n cur.ch[c] = new TrieNode();\n }\n cur =...
3
0
['Trie', 'JavaScript']
1
sum-of-prefix-scores-of-strings
✅✅Faster || Easy To Understand || C++ Code
faster-easy-to-understand-c-code-by-__kr-ycjg
Trie\n\n Time Complexity :- O(N * M)\n\n Space Complexity :- O(N)\n\n\nclass Solution {\npublic:\n \n // structure for TrieNode\n \n struct TrieNode
__KR_SHANU_IITG
NORMAL
2022-09-18T05:38:48.648195+00:00
2022-09-18T05:38:48.648232+00:00
289
false
* ***Trie***\n\n* ***Time Complexity :- O(N * M)***\n\n* ***Space Complexity :- O(N)***\n\n```\nclass Solution {\npublic:\n \n // structure for TrieNode\n \n struct TrieNode\n {\n TrieNode* child[26];\n \n int count;\n \n TrieNode()\n {\n count = 0;\n ...
3
0
['Trie', 'C', 'C++']
0
sum-of-prefix-scores-of-strings
Easy peasy || Trie
easy-peasy-trie-by-kageyama09-21o4
Using normal trie implementation with a branch property which at any node wil tell us the total number of branches that are merged with the current path i.e, th
kageyama09
NORMAL
2022-09-18T04:10:15.945624+00:00
2022-09-18T04:10:15.945650+00:00
115
false
Using normal trie implementation with a **branch** property which at any node wil tell us the total number of branches that are merged with the current path i.e, the total number of prefixes ending at the current node.\nImplementing this and storing all the string in that trie will be a key to that answer, because afte...
3
0
['Trie']
0
sum-of-prefix-scores-of-strings
Trie [Count and fetch] | C++
trie-count-and-fetch-c-by-xxvvpp-k098
C++\n struct trie {\n trie *child[26] = {};\n int count=0;\n }; \n \n vector sumPrefixScores(vector& A) {\n trie td;\n \n
xxvvpp
NORMAL
2022-09-18T04:02:12.182150+00:00
2022-09-18T04:18:59.036580+00:00
143
false
# C++\n struct trie {\n trie *child[26] = {};\n int count=0;\n }; \n \n vector<int> sumPrefixScores(vector<string>& A) {\n trie td;\n \n //put all words\n for(auto w:A){\n //insert word in trie\n auto root= &td;\n for(auto j:w){\n ...
3
0
['Trie', 'C']
0
sum-of-prefix-scores-of-strings
trie| c++ 🔥 the very fundamental of trie data structure Easy & Intutive
trie-c-the-very-fundamental-of-trie-data-b4kc
first of all how we can identify that this problem is related to trie data structure?\n\n\ntime complexcity total: Sum (size of each words)<=10^6\nspace complex
demon_code
NORMAL
2024-09-25T17:37:19.233104+00:00
2024-09-26T17:11:54.734508+00:00
7
false
first of all how we can identify that this problem is related to trie data structure?\n\n```\ntime complexcity total: Sum (size of each words)<=10^6\nspace complexcity total : Sum (size of each words) <=10^6\n```\n\nfirst when we see what they are asking is calculate sum of ( frequencies of prefixes (prifix which is g...
2
0
['Trie', 'C']
0
sum-of-prefix-scores-of-strings
Fastest Solution in Java with Explanation
fastest-solution-in-java-with-explanatio-w1qu
Intuition\n Describe your first thoughts on how to solve this problem. \nThe goal of this problem is to calculate a score for each word, where the score is the
heyysankalp
NORMAL
2024-09-25T16:30:23.839791+00:00
2024-09-28T12:16:21.388542+00:00
40
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nThe goal of this problem is to calculate a score for each word, where the score is the sum of lengths of common prefixes between the word and every other word in the input array. To efficiently compute this, sorting the words and processi...
2
0
['Array', 'String', 'Trie', 'Counting', 'Java']
1
sum-of-prefix-scores-of-strings
EASY AND BEGINNER FRIENDLY PYTHON SOLUTION🔥🔥🔥
easy-and-beginner-friendly-python-soluti-1xld
Intuition\nThe problem requires calculating the prefix score of each word, which depends on how many other words share the same prefix at each step. A Trie (pre
FAHAD_26
NORMAL
2024-09-25T14:28:10.271245+00:00
2024-09-25T14:28:10.271287+00:00
10
false
# Intuition\nThe problem requires calculating the prefix score of each word, which depends on how many other words share the same prefix at each step. A Trie (prefix tree) is ideal for such tasks because it allows efficient prefix matching. By building a Trie with all the words and keeping track of how many words pass ...
2
0
['Python']
0
sum-of-prefix-scores-of-strings
Concise and beautiful Trie | Cracking Hard into Easy
concise-and-beautiful-trie-cracking-hard-tyvz
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \nJust use a custom Trie,
sulerhy
NORMAL
2024-09-25T12:02:45.722178+00:00
2024-09-25T12:02:45.722218+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. -->\nJust use a custom Trie, with infomation of `count` as the number of words in `words` which also has this character\n\n# Complexity\n- Time complexity: O(n * k)\n<!-- A...
2
0
['String', 'Trie', 'Python3']
0
sum-of-prefix-scores-of-strings
Small & Simple Graph Count Traversal in Kotlin (Beats 100%)
small-simple-graph-count-traversal-in-ko-jmml
\n\n# Intuition\nThe question that was asked; to sum up all the prefixes and occurences for every seperate word, can be achieved by simply counting how many tim
mdekaste
NORMAL
2024-09-25T11:08:19.176137+00:00
2024-09-25T11:14:18.498386+00:00
36
false
![image.png](https://assets.leetcode.com/users/images/385a22eb-35a2-4332-96e3-9a2e821e938a_1727262815.5776465.png)\n\n# Intuition\nThe question that was asked; to sum up all the prefixes and occurences for every seperate word, can be achieved by simply counting how many times a character reaches a node in a graph.\n\n#...
2
0
['Trie', 'Kotlin']
1
sum-of-prefix-scores-of-strings
JAVA EASY SOLUTION
java-easy-solution-by-007harsh-qc0o
Intuition\n Describe your first thoughts on how to solve this problem. \nThe problem requires counting how many strings in the given list start with each prefix
007Harsh-
NORMAL
2024-09-25T09:37:22.152039+00:00
2024-09-25T09:37:22.152073+00:00
16
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nThe problem requires counting how many strings in the given list start with each prefix of every word. A naive approach would be to check each prefix of every word against all other words, but this would be inefficient. Using a Trie `(Pre...
2
0
['Trie', 'Prefix Sum', 'Java']
0
sum-of-prefix-scores-of-strings
Easy Solution || C++ || Tries || TC- O(N*L)
easy-solution-c-tries-tc-onl-by-manavtor-ke9p
Intuition\nWhen solving this problem, the main challenge is calculating the prefix scores efficiently for multiple words. A brute force approach of calculating
manavtore
NORMAL
2024-09-25T08:40:31.502404+00:00
2024-09-25T08:40:31.502460+00:00
52
false
# Intuition\nWhen solving this problem, the main challenge is calculating the prefix scores efficiently for multiple words. A brute force approach of calculating prefix scores individually for each word would be inefficient, especially with longer word lists. The Trie (prefix tree) data structure is well-suited for pro...
2
0
['Array', 'String', 'Trie', 'Counting', 'C++']
1
sum-of-prefix-scores-of-strings
C++ Simple Trie / Prefix Tree implementation
c-simple-trie-prefix-tree-implementation-5ibo
Intuition\n- In this problem we need to find the number of strings that has a prefix in the current string.\n- Thus when it comes to counting prefixes of string
Codesmith28
NORMAL
2024-09-25T06:47:41.969002+00:00
2024-09-25T12:50:45.244243+00:00
23
false
# Intuition\n- In this problem we need to find the number of strings that has a prefix in the current string.\n- Thus when it comes to counting prefixes of strings and counting occurrences, we can rely on Trie / prefix tree data structure to efficiently store the strings and traverse through them.\n# What is Trie ?\n- ...
2
0
['String', 'Trie', 'Counting', 'C++']
0
sum-of-prefix-scores-of-strings
C++ Solution || Trie
c-solution-trie-by-rohit_raj01-t8z9
Intuition\nThe problem is about calculating a score for each word based on how many times its prefixes appear across all the words in the input list. A Trie (pr
Rohit_Raj01
NORMAL
2024-09-25T06:33:47.863491+00:00
2024-09-25T06:33:47.863522+00:00
47
false
# Intuition\nThe problem is about calculating a score for each word based on how many times its prefixes appear across all the words in the input list. A Trie (prefix tree) is an efficient data structure for handling prefix-based problems because it allows for fast insertion and traversal of strings. By storing prefix ...
2
0
['String', 'Trie', 'C++']
0
sum-of-prefix-scores-of-strings
Simple C++ solution | TRIE
simple-c-solution-trie-by-saurabhdamle11-p6qt
Intuition\nFor every word, we need to find all the prefixes and get the count of all such prefixes which will be the score of that word.\n\nSince we need to fin
saurabhdamle11
NORMAL
2024-09-25T05:26:22.391583+00:00
2024-09-25T05:26:22.391620+00:00
71
false
# Intuition\nFor every word, we need to find all the prefixes and get the count of all such prefixes which will be the score of that word.\n\nSince we need to find and store all the prefixes, a Trie will be the best Data Structure to use here.\n\n# Approach\n1. Initialize a trie and insert all the words into the trie.\...
2
0
['Array', 'String', 'Trie', 'Counting', 'C++']
2
sum-of-prefix-scores-of-strings
[C++] ✅|| 2 Approach | HashMap & Trie | Easy to understand 🚀
c-2-approach-hashmap-trie-easy-to-unders-3941
Approach - 1: (Using Hashmap) \n\nclass Solution {\npublic:\n vector<int> sumPrefixScores(vector<string>& words) \n {\n unordered_map<string, int>m
RIOLOG
NORMAL
2024-09-25T05:06:59.978248+00:00
2024-09-25T05:07:35.685520+00:00
27
false
Approach - 1: (Using Hashmap) \n```\nclass Solution {\npublic:\n vector<int> sumPrefixScores(vector<string>& words) \n {\n unordered_map<string, int>mp;\n for (int i=0;i<words.size();i++)\n {\n string temp = "";\n string curr = words[i];\n \n for (i...
2
0
['Trie', 'C']
0
sum-of-prefix-scores-of-strings
HashMap Solution
hashmap-solution-by-jastegsingh007-y1ql
Soch\nFollowing up for yesterday\'s POTD, store all subsets with there subset and count and just add them\n\n# Code\npython3 []\nclass Solution:\n def sumPre
jastegsingh007
NORMAL
2024-09-25T04:20:33.876354+00:00
2024-09-25T04:20:33.876403+00:00
243
false
# Soch\nFollowing up for yesterday\'s POTD, store all subsets with there subset and count and just add them\n\n# Code\n```python3 []\nclass Solution:\n def sumPrefixScores(self, words: List[str]) -> List[int]:\n k=defaultdict(int)\n ans=[]\n for i in words:\n for j in range(len(i)):\n...
2
0
['Python3']
2
sum-of-prefix-scores-of-strings
Java: Trie solution with comments and explanation. Easy to understand.
java-trie-solution-with-comments-and-exp-jmlc
Intuition\nWe are given a array of words. For each word, we need to compute prefix score. Any word of length n has n prefixes. For example, word abcd has prefix
cg7293
NORMAL
2024-09-25T04:09:51.117128+00:00
2024-09-25T04:09:51.117192+00:00
65
false
# Intuition\nWe are given a array of words. For each word, we need to compute $$prefix score.$$ Any word of length `n` has `n` prefixes. For example, word `abcd` has prefixes `a`, `ab`, `abc` and `abcd`. For each prefix we need to find number of times it occurs in the words array.\n\n# Approach\nFor each word, we add t...
2
0
['Trie', 'Java']
0
sum-of-prefix-scores-of-strings
Simple trie
simple-trie-by-vortexz-sf3i
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
vortexz
NORMAL
2024-09-25T03:10:53.576254+00:00
2024-09-25T03:10:53.576302+00:00
39
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
['Trie', 'C']
0
sum-of-prefix-scores-of-strings
Python 3 solution - clean use of trie data structure and hash map soluton.
python-3-solution-clean-use-of-trie-data-xn6b
Code\npython [Prefix Trie]\nclass TrieNode:\n def __init__(self):\n self.children = {}\n self.count = 0\n\nclass Trie:\n def __init__(self):
iloabachie
NORMAL
2024-09-25T01:51:51.114003+00:00
2024-09-25T03:00:15.836290+00:00
231
false
# Code\n```python [Prefix Trie]\nclass TrieNode:\n def __init__(self):\n self.children = {}\n self.count = 0\n\nclass Trie:\n def __init__(self):\n self.root = TrieNode()\n \n def insert(self, words: List[str]) -> None:\n for word in words:\n current = self.root\n ...
2
0
['Python3']
0
sum-of-prefix-scores-of-strings
TRIE makes it easy !!
trie-makes-it-easy-by-saurav_1928-qz1w
\n# Code\ncpp []\nclass Node {\npublic:\n unordered_map<char, pair<Node*, int>> arr;\n bool isEnd = false;\n};\n\nvoid insert(Node* root, string& word) {\
saurav_1928
NORMAL
2024-09-25T01:18:51.249115+00:00
2024-09-25T01:18:51.249195+00:00
61
false
\n# Code\n```cpp []\nclass Node {\npublic:\n unordered_map<char, pair<Node*, int>> arr;\n bool isEnd = false;\n};\n\nvoid insert(Node* root, string& word) {\n Node* curr = root;\n for (auto ch : word) {\n if (curr->arr.find(ch) == curr->arr.end()) {\n curr->arr[ch] = {new Node(), 0};\n ...
2
0
['Array', 'String', 'Trie', 'Counting', 'C++']
1
sum-of-prefix-scores-of-strings
Easy, well explained Javascript and Trie solution
easy-well-explained-javascript-and-trie-oheti
Intuition\nThe task is to compute the prefix score for each word by summing how many words share each prefix. It\'s possible to solve it using a HashMap, but it
balfin
NORMAL
2024-09-25T00:40:20.205023+00:00
2024-09-25T00:41:56.490448+00:00
157
false
# Intuition\nThe task is to compute the prefix score for each word by summing how many words share each prefix. It\'s possible to solve it using a HashMap, but it will fail by time limit on the last casess, so more efficient data structure is needed. Using a Trie allows us to efficiently store and count shared prefixes...
2
0
['Trie', 'JavaScript']
0
sum-of-prefix-scores-of-strings
brain dead solution in python
brain-dead-solution-in-python-by-mostkno-veeq
Intuition\nUses the idea of tries but no tries hehe\n\nHonestly, just build the prefix of a word as you go.\n\n# Approach\nFor each word, I create a buffer and
mostknownunknown
NORMAL
2023-02-06T02:09:20.985569+00:00
2023-02-06T02:09:20.985614+00:00
263
false
# Intuition\nUses the idea of tries but no tries hehe\n\nHonestly, just build the prefix of a word as you go.\n\n# Approach\nFor each word, I create a `buffer` and build a prefix for each character of the word.\n\nSo I continuously build a `buffer` character at a time without doing some weird indexing calculation.\n\nO...
2
0
['Python3']
0
sum-of-prefix-scores-of-strings
Count all Prefixes in a Hash Map
count-all-prefixes-in-a-hash-map-by-jana-zbky
Intuition\nIterate over all the workds x prefixes and create a hashmap of all prefix counts. Then just use that to count the score\n\n# Approach\niterate over a
janakagoon
NORMAL
2023-01-15T05:09:12.802485+00:00
2023-01-15T05:09:12.802533+00:00
57
false
# Intuition\nIterate over all the workds x prefixes and create a hashmap of all prefix counts. Then just use that to count the score\n\n# Approach\niterate over all the workds x prefixes and create a hashmap of all prefix counts. Then just use that to count the score\n\n# Complexity\n- Time complexity:\nO(W x L)\n\nW: ...
2
0
['Go']
0
sum-of-prefix-scores-of-strings
C++ | Trie + search Prefixes
c-trie-search-prefixes-by-ajay_5097-i7zi
cpp\nclass TrieNode {\npublic:\n vector<TrieNode*> child;\n int availablePrefix;\n};\n\nconst int CHILD_COUNT = 26;\nconst int nax = 1e7 + 9;\nTrieNode po
ajay_5097
NORMAL
2022-11-21T11:08:02.135159+00:00
2022-11-21T11:08:02.135206+00:00
1,085
false
```cpp\nclass TrieNode {\npublic:\n vector<TrieNode*> child;\n int availablePrefix;\n};\n\nconst int CHILD_COUNT = 26;\nconst int nax = 1e7 + 9;\nTrieNode pool[nax];\nint cnt;\nTrieNode *getNode() {\n auto t = &pool[cnt++];\n t->child.resize(CHILD_COUNT);\n for (int i = 0; i < CHILD_COUNT; ++i) {\n ...
2
0
[]
0
sum-of-prefix-scores-of-strings
[Javascript] Simple Trie implementation
javascript-simple-trie-implementation-by-mkk3
It\'s a pretty simple and understandable solution, written in Javascript\n\n```\nvar sumPrefixScores = function(words) {\n const n = words.length;\n const
vik_13
NORMAL
2022-11-17T10:25:56.537869+00:00
2022-11-18T23:30:52.905921+00:00
152
false
It\'s a pretty simple and understandable solution, written in Javascript\n\n```\nvar sumPrefixScores = function(words) {\n const n = words.length;\n const trie = {_count: 0};\n const result = [];\n \n\t// Create our own custom trie with _count property.\n // We are storing how many time we passed current...
2
0
['Trie', 'JavaScript']
0
sum-of-prefix-scores-of-strings
Python | Trie | Modular clean code
python-trie-modular-clean-code-by-jnaik-3b4l
Standard Trie implmentation, which I follow to solve all the Trie problems with just slight variation in search and insert method as per problem statement. Maki
jnaik
NORMAL
2022-10-21T17:17:45.347485+00:00
2022-10-21T17:31:55.054512+00:00
121
false
Standard Trie implmentation, which I follow to solve all the Trie problems with just slight variation in search and insert method as per problem statement. Making a habit to follow a template makes you fast and well organized and it leaves the best impression on interviewer.\n\nSolution inspired from: https://leetcode....
2
0
['String', 'Trie', 'Python', 'Python3']
0
sum-of-prefix-scores-of-strings
Java | Trie | Detailed Explanation and Comments
java-trie-detailed-explanation-and-comme-7t41
Here I will explain the super detailed thought process to solve this problem. For a concise explanation, only read section Problem Approach and Final Approach I
zheng_four_oranges
NORMAL
2022-09-24T02:53:05.425818+00:00
2022-09-24T02:58:20.659346+00:00
291
false
Here I will explain the super detailed thought process to solve this problem. For a concise explanation, only read section **Problem Approach** and **Final Approach Implementation**.\n\n**Problem Approach:**\nFor each String **S** in words, for all **S\'s prefixes Sj** (**j denoting the length of Sj**), we essentially ...
2
0
['Depth-First Search', 'Trie', 'Java']
1
sum-of-prefix-scores-of-strings
Beginner Friendly Trie Implementation | C++ Solution
beginner-friendly-trie-implementation-c-t5xko
In addition to the general implementation of Trie, Storing an extra information how many prefixes end with a specific character in each node.\n\nstruct node{\n
wa_survivor
NORMAL
2022-09-18T17:27:59.676905+00:00
2022-09-18T17:28:28.550459+00:00
211
false
In addition to the general implementation of Trie, Storing an extra information how many prefixes end with a specific character in each node.\n```\nstruct node{\n node* mp[26];\n int cnt[26];\n bool isPresent(char c){\n if(mp[c-\'a\']==NULL) return false;\n return true;\n }\n node* getKey(c...
2
0
['Trie', 'C', 'C++']
0
sum-of-prefix-scores-of-strings
Trie Java Solution.
trie-java-solution-by-harshraj9988-jh3j
\nclass Solution {\n\tclass TrieNode {\n TrieNode[] next;\n int[] cnt;\n\n public TrieNode() {\n next = new TrieNode[26];\n
HarshRaj9988
NORMAL
2022-09-18T05:40:03.269899+00:00
2022-09-18T05:40:03.269946+00:00
39
false
```\nclass Solution {\n\tclass TrieNode {\n TrieNode[] next;\n int[] cnt;\n\n public TrieNode() {\n next = new TrieNode[26];\n cnt = new int[26];\n }\n\n \n }\n\n public void insert(String word, TrieNode root) {\n TrieNode curr = root;\n for (...
2
0
['Depth-First Search', 'Trie']
0
sum-of-prefix-scores-of-strings
C++ Easy Solution | Trie
c-easy-solution-trie-by-b_rabbit007-slnc
I have created Trie data structure with array of pointers next to point all alphabets and wordCount which will store number of words having prefix string ending
B_Rabbit007
NORMAL
2022-09-18T05:06:07.081209+00:00
2022-09-23T01:45:51.031904+00:00
53
false
I have created `Trie` data structure with array of pointers `next` to point all alphabets and `wordCount` which will store number of words having prefix string ending at current node.\n\nFor example - consider array of strings `["abc", "ab", "b"]`\nTrie will be like -\n```\n\t\t\t\t\t\t\t Root\n\t\t\t\t\t\t wordCount =...
2
0
['Trie', 'C']
0
sum-of-prefix-scores-of-strings
Python3 ✅ || Simple Trie
python3-simple-trie-by-husharbabu-dqbu
`.\nclass TrieNode:\n def __init__(self):\n self.children = {}\n self.word = False\n self.count = 1\n \nclass
HusharBabu
NORMAL
2022-09-18T04:42:08.785353+00:00
2022-09-18T04:42:08.785391+00:00
32
false
```.\nclass TrieNode:\n def __init__(self):\n self.children = {}\n self.word = False\n self.count = 1\n \nclass Trie:\n def __init__(self):\n self.root = TrieNode()\n\n def insert(self, word):\n trav = self.root\n for c in word:\n ...
2
0
[]
0
sum-of-prefix-scores-of-strings
Java | Roling Hash
java-roling-hash-by-aaveshk-dhk1
\nclass Solution\n{\n final int m = 1023;\n public int[] sumPrefixScores(String[] words)\n {\n HashMap<Long,Integer> map = new HashMap<>();\n
aaveshk
NORMAL
2022-09-18T04:22:19.628297+00:00
2022-09-18T04:22:30.890943+00:00
243
false
```\nclass Solution\n{\n final int m = 1023;\n public int[] sumPrefixScores(String[] words)\n {\n HashMap<Long,Integer> map = new HashMap<>();\n for(String S : words)\n {\n char[] s = S.toCharArray();\n long hash_so_far = 0L;\n int n = s.length;\n ...
2
0
['Rolling Hash', 'Java']
2
sum-of-prefix-scores-of-strings
SIMPLE TRIE | C++ | BRUTE FORCE
simple-trie-c-brute-force-by-deepanshu_d-icx7
TRIE PRACTICE PROBLEMS \n\n1. Implement Trie (Prefix Tree)\n2. Maximum XOR of Two Numbers in an Array\n3. Search Suggestions System\n\n// trie node \nstruct no
Deepanshu_Dhakate
NORMAL
2022-09-18T04:19:23.567619+00:00
2022-09-18T04:19:23.567664+00:00
73
false
**TRIE PRACTICE PROBLEMS **\n\n[1. Implement Trie (Prefix Tree)](https://leetcode.com/problems/implement-trie-prefix-tree/)\n[2. Maximum XOR of Two Numbers in an Array](https://leetcode.com/problems/maximum-xor-of-two-numbers-in-an-array/)\n[3. Search Suggestions System](https://leetcode.com/problems/search-suggestions...
2
1
['Depth-First Search', 'Trie', 'C']
0
sum-of-prefix-scores-of-strings
C++ | Trie Solution
c-trie-solution-by-travanj05-hxai
cpp\nclass Node {\npublic:\n char ch;\n Node* children[26] = {nullptr};\n int prefix_cnt;\n};\n\nclass Solution {\nprivate:\n Node* root = new Node;
travanj05
NORMAL
2022-09-18T04:14:11.844955+00:00
2022-09-18T04:14:11.844986+00:00
43
false
```cpp\nclass Node {\npublic:\n char ch;\n Node* children[26] = {nullptr};\n int prefix_cnt;\n};\n\nclass Solution {\nprivate:\n Node* root = new Node;\n int prefixCount(string &prefix) {\n Node* tmp = root;\n int cnt = 0;\n for (char &ch : prefix) {\n int index = ch - \'a...
2
0
['Trie', 'C', 'C++']
0
sum-of-prefix-scores-of-strings
[Java] Trie | O(NM) Time | Easy to Understand
java-trie-onm-time-easy-to-understand-by-17es
java\nclass Solution {\n public int[] sumPrefixScores(String[] words) {\n if (words.length == 1) {\n return new int[] { words[0].length() }
jjeeffff
NORMAL
2022-09-18T04:12:10.387993+00:00
2022-09-21T08:09:55.883935+00:00
227
false
``` java\nclass Solution {\n public int[] sumPrefixScores(String[] words) {\n if (words.length == 1) {\n return new int[] { words[0].length() };\n }\n \n Trie trie = new Trie();\n for (String word : words) {\n trie.addWord(word);\n }\n int[] ans ...
2
0
['Trie', 'Java']
0
sum-of-prefix-scores-of-strings
Java || Trie Solution
java-trie-solution-by-yog_esh-361o
\nclass Solution {\n public int[] sumPrefixScores(String[] words) {\n \n Tries trie=new Tries();\n \n \n \n for(Str
yog_esh
NORMAL
2022-09-18T04:07:00.240820+00:00
2022-09-18T04:07:00.240846+00:00
397
false
```\nclass Solution {\n public int[] sumPrefixScores(String[] words) {\n \n Tries trie=new Tries();\n \n \n \n for(String word:words){\n \n add(word,trie);\n }\n \n int[] res=new int[words.length];\n \n \n for(i...
2
0
['Trie', 'Java']
1
sum-of-prefix-scores-of-strings
Very simple Python trie code
very-simple-python-trie-code-by-rjmcmc-xked
```\nclass Solution:\n def sumPrefixScores(self, words: List[str]) -> List[int]:\n trie = {}\n \n for word in words:\n t = tr
rjmcmc
NORMAL
2022-09-18T04:03:19.731203+00:00
2022-09-18T04:03:19.731241+00:00
67
false
```\nclass Solution:\n def sumPrefixScores(self, words: List[str]) -> List[int]:\n trie = {}\n \n for word in words:\n t = trie\n for char in word:\n if char not in t:\n t[char] = {}\n t = t[char]\n if \'$\' no...
2
0
[]
0
sum-of-prefix-scores-of-strings
Simple Solution Using Trie Tree
simple-solution-using-trie-tree-by-pbara-ycv3
The question gives Intution of Trie tree as storing all the prefixes will cause TLE\n\nWith the standard implementation of trie tree we can keep a array of coun
pbarak6
NORMAL
2022-09-18T04:02:07.624350+00:00
2022-09-18T04:02:07.624389+00:00
124
false
The question gives Intution of Trie tree as storing all the prefixes will cause TLE\n\nWith the standard implementation of trie tree we can keep a array of count that will count the frequency of that charcater\n\n=>> Below is the simple CPP implementation\n\n```\nstruct Node{\n bool flag=false;\n int count[26] = ...
2
0
['Tree', 'Trie', 'C++']
1
sum-of-prefix-scores-of-strings
[JavaScript] Trie
javascript-trie-by-jialihan-cv7c
\nclass TrieNode {\n constructor() {\n this.children = {};\n this.cnt = 0;\n }\n}\n\n\nvar sumPrefixScores = function(words) {\n const ro
jialihan
NORMAL
2022-09-18T04:01:40.170494+00:00
2022-09-18T04:01:40.170546+00:00
97
false
```\nclass TrieNode {\n constructor() {\n this.children = {};\n this.cnt = 0;\n }\n}\n\n\nvar sumPrefixScores = function(words) {\n const root = new TrieNode();\n function add(w) {\n let cur = root;\n for(let i = 0; i<w.length; i++){\n const c = w[i];\n if(!cur...
2
1
['Trie', 'JavaScript']
0
sum-of-prefix-scores-of-strings
trie cpp
trie-cpp-by-sreyash_11-1hc5
space complexity here, e.g. O(n) -->Code
sreyash_11
NORMAL
2025-03-17T06:50:17.580238+00:00
2025-03-17T06:50:17.580238+00:00
7
false
space complexity here, e.g. $$O(n)$$ --> # Code ```cpp [] struct Node { Node *links[26]; int precnt = 0; Node() { for (int i = 0; i < 26; i++) links[i] = nullptr; } bool containsKey(char ch) { return links[ch - 'a'] != nullptr; } Node* get(char ch) { return links[ch...
1
0
['String', 'Trie', 'String Matching', 'C++']
0
type-of-triangle
✅THE BEST EXPLANATION||Beats 100% Users
the-best-explanationbeats-100-users-by-h-00os
---\n# PLEASE UPVOTE IF YOU LIKE IT \u2705\n---\n\n\n---\n# Intuition\n Describe your first thoughts on how to solve this problem. \n\nThe goal is to determine
harshal2024
NORMAL
2024-02-03T16:16:02.600254+00:00
2024-02-03T16:16:02.600277+00:00
1,830
false
---\n# PLEASE UPVOTE IF YOU LIKE IT \u2705\n---\n![Screenshot (3250).png](https://assets.leetcode.com/users/images/29a1896c-a303-4a77-b58e-6d8ce83c737e_1705810439.8498056.png)\n\n---\n# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\nThe goal is to determine the type of triangle that c...
13
0
['Python', 'C++', 'Java', 'Python3']
1
type-of-triangle
Sort
sort-by-votrubac-q5jc
We sort the sides first to simplify the logic.\n\nC++\ncpp\nstring triangleType(vector<int>& n) {\n sort(begin(n), end(n));\n if (n[2] >= n[0] + n[1])\n
votrubac
NORMAL
2024-02-03T16:04:32.494865+00:00
2024-02-03T16:04:32.494895+00:00
1,259
false
We sort the sides first to simplify the logic.\n\n**C++**\n```cpp\nstring triangleType(vector<int>& n) {\n sort(begin(n), end(n));\n if (n[2] >= n[0] + n[1])\n return "none";\n return n[0] == n[2] ? "equilateral" : n[0] == n[1] || n[1] == n[2] ? "isosceles" : "scalene";\n}\n```
13
1
['C']
5
type-of-triangle
Simple java solution
simple-java-solution-by-siddhant_1602-0hto
Complexity\n- Time complexity: O(1)\n\n- Space complexity: O(1)\n\n# Code\n\nclass Solution {\n public String triangleType(int[] nums) {\n if(nums[0]+
Siddhant_1602
NORMAL
2024-02-03T16:01:16.030489+00:00
2024-02-03T16:06:45.022384+00:00
783
false
# Complexity\n- Time complexity: $$O(1)$$\n\n- Space complexity: $$O(1)$$\n\n# Code\n```\nclass Solution {\n public String triangleType(int[] nums) {\n if(nums[0]+nums[1]>nums[2] && nums[1]+nums[2]>nums[0] && nums[2]+nums[0]>nums[1])\n {\n if(nums[0]==nums[1] && nums[1]==nums[2])\n ...
12
0
['Java']
0
type-of-triangle
Without if-else spaghetti
without-if-else-spaghetti-by-almostmonda-teqg
Intuition\n Describe your first thoughts on how to solve this problem. \nThe \space Triangle \space Inequality \space Theorem says:\n> The sum of two sides of a
almostmonday
NORMAL
2024-02-03T20:53:35.920274+00:00
2024-02-03T21:37:46.827111+00:00
379
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n$$The \\space Triangle \\space Inequality \\space Theorem$$ says:\n> The sum of two sides of a triangle must be greater than the third side.\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nFind the right type of a ...
8
1
['Geometry', 'Python', 'Python3']
3
type-of-triangle
Sort & 3 conditions
sort-3-conditions-by-kreakemp-frlb
\n# C++\n\nstring triangleType(vector<int>& nums) {\n sort(nums.begin(), nums.end());\n if(nums[0] + nums[1] <= nums[2]) return "none";\n if(nums[0] ==
kreakEmp
NORMAL
2024-02-03T16:42:41.170212+00:00
2024-02-03T16:42:50.220112+00:00
2,567
false
\n# C++\n```\nstring triangleType(vector<int>& nums) {\n sort(nums.begin(), nums.end());\n if(nums[0] + nums[1] <= nums[2]) return "none";\n if(nums[0] == nums[1] && nums[1] == nums[2]) return "equilateral";\n if(nums[0] == nums[1] || nums[1] == nums[2]) return "isosceles";\n return "scalene";\n}\n```\n\...
7
1
['C++', 'Java']
4
type-of-triangle
Type of Triangle📐🔍: Simple if-else ✨|| 0ms⏰ ||Beats 100%✅ || JAVA ☕️
type-of-triangle-simple-if-else-0ms-beat-myd9
\n# Intuition\nYou\'re checking the type of triangle based on its side lengths, following these rules:\n\n- If any side length is greater than or equal to the s
Megha_Mathur18
NORMAL
2024-06-23T14:16:52.692709+00:00
2024-06-23T14:18:41.489093+00:00
117
false
![Screenshot 2024-06-23 192115.png](https://assets.leetcode.com/users/images/cc0b01c6-db19-4f2d-8b18-41c620006af1_1719151803.590607.png)\n# Intuition\nYou\'re checking the type of triangle based on its side lengths, following these rules:\n\n- If any side length is greater than or equal to the sum of the other two side...
6
0
['Java']
0
type-of-triangle
[Java] ✅ ⬆️ | Simple 🔥🔥 | Clean | Self Explanatory
java-simple-clean-self-explanatory-by-sa-2nep
Complexity\nTime complexity: O(1)\nSpace complexity: O(1)\n\npublic String triangleType(int[] nums) {\n int a = nums[0];\n int b = nums[1];\n
sandeepk97
NORMAL
2024-02-03T16:35:16.785226+00:00
2024-02-03T16:37:54.391528+00:00
248
false
**Complexity**\nTime complexity: O(1)\nSpace complexity: O(1)\n```\npublic String triangleType(int[] nums) {\n int a = nums[0];\n int b = nums[1];\n int c = nums[2];\n\n if (isValidTriangle(a, b, c)) {\n if (a == b && b == c) {\n return "equilateral";\n }...
5
0
['Java']
1
type-of-triangle
🔥BEATS 💯 % 🎯 |✨SUPER EASY FOR BEGINNERS 👏
beats-super-easy-for-beginners-by-vignes-f5u7
Code
vigneshvaran0101
NORMAL
2025-02-25T17:00:14.251211+00:00
2025-02-25T17:00:14.251211+00:00
136
false
![image.png](https://assets.leetcode.com/users/images/67baed19-1db8-4091-b767-6e56916e2db1_1740502799.954998.png) # Code ```python3 [] class Solution: def triangleType(self, nums: List[int]) -> str: if nums[0] >= nums[1] + nums[2] or nums[1] >= nums[0] + nums[2] or nums[2] >= nums[0] + nums[1]: ...
3
0
['Python3']
0
type-of-triangle
Java Check None first
java-check-none-first-by-hobiter-u869
See code. \n# Complexity\n- Time complexity:\n Add your time complexity here, e.g. O(n) \nO(1)\n- Space complexity:\n Add your space complexity here, e.g. O(n)
hobiter
NORMAL
2024-02-04T21:57:58.178602+00:00
2024-02-04T21:57:58.178620+00:00
871
false
See code. \n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\nO(1)\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\nO(1)\n# Code\n```\nclass Solution {\n final String EQ = "equilateral";\n final String ISO = "isosceles";\n final String SCA = "...
3
0
['Java']
0
type-of-triangle
✅Beats 100% || Classifying triangles in Java, Python & C++
beats-100-classifying-triangles-in-java-xl2tw
Intuition\nThe code checks the validity of a triangle based on its side lengths and classifies it as equilateral, isosceles, scalene, or none.\n\n# Approach\nTh
Mohit-P
NORMAL
2024-02-03T16:32:57.937652+00:00
2024-02-03T16:32:57.937675+00:00
203
false
# Intuition\nThe code checks the validity of a triangle based on its side lengths and classifies it as equilateral, isosceles, scalene, or none.\n\n# Approach\nThe approach involves using conditional statements to check the triangle\'s validity and then determining its type based on the side lengths.\n\n# Complexity\n-...
3
0
['Python', 'C++', 'Java']
1
type-of-triangle
Easy to Understand | Beats 100% | O(1) | 0ms Runtime🔥🧯🦹🏻‍♀️
easy-to-understand-beats-100-o1-0ms-runt-7ata
Intuition : FOR THE LACKWITS!! equilateral if it has all sides of equal length. isosceles if it has exactly two sides of equal length. scalene if all its sides
tyagideepti9
NORMAL
2025-01-30T17:10:42.700338+00:00
2025-01-30T17:13:28.103898+00:00
373
false
# Intuition : FOR THE LACKWITS!! - equilateral if it has all sides of equal length. - isosceles if it has exactly two sides of equal length. - scalene if all its sides are of different lengths. - sum of two sides is not greater than third one, then not a valid triangle <!-- Describe your first thoughts on how to solve...
2
0
['Array', 'Math', 'Sorting', 'Java', 'C#', 'MS SQL Server']
1
type-of-triangle
Easy To Understand | Beats 100% | O(1) | 0ms runtime 🔥🧯
easy-to-understand-beats-100-o1-0ms-runt-kmnp
Intuition - FOR THE LACKWITS!!Two Side Sum < Third Side - Not a Triangle All Sides Equal - Equilateral Two Sides Equal - Isosceles No Side Equal - ScaleneApproa
aman-sagar
NORMAL
2025-01-30T17:09:46.780862+00:00
2025-01-30T17:10:34.887117+00:00
252
false
# Intuition - FOR THE LACKWITS!! <!-- Describe your first thoughts on how to solve this problem. --> Two Side Sum < Third Side - Not a Triangle All Sides Equal - Equilateral Two Sides Equal - Isosceles No Side Equal - Scalene # Approach <!-- Describe your approach to solving the problem. --> If if elif elif else else ...
2
0
['Array', 'Math', 'Sorting', 'C++', 'Python3', 'MySQL']
1
type-of-triangle
easy answer for the questions beats 100%
easy-answer-for-the-questions-beats-100-pzum5
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
wfjvxY4Pch
NORMAL
2024-08-26T17:02:14.322395+00:00
2024-08-26T17:02:14.322422+00:00
79
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
['Java']
0
type-of-triangle
Easy Java Solution || Beginner Friendly
easy-java-solution-beginner-friendly-by-jq0ex
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
anikets101
NORMAL
2024-04-20T13:53:49.037239+00:00
2024-04-20T13:53:49.037288+00:00
33
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
['Java']
0
type-of-triangle
THE EASIEST SOLUTION FOR YOU | Type of Triangle | 3024
the-easiest-solution-for-you-type-of-tri-dbkp
\n# Code\n\nclass Solution:\n def triangleType(self, nums: List[int]) -> str:\n ns = set(nums)\n l = len(ns)\n a, b, c = nums[0], nums[1
JustChis100
NORMAL
2024-03-22T13:17:09.579457+00:00
2024-03-22T13:17:09.579489+00:00
172
false
\n# Code\n```\nclass Solution:\n def triangleType(self, nums: List[int]) -> str:\n ns = set(nums)\n l = len(ns)\n a, b, c = nums[0], nums[1], nums[2]\n if not (a < b + c and b < a + c and c < b + a) :\n return "none"\n if l == 2 :\n return "isosceles"\n ...
2
0
['Array', 'Math', 'Python', 'Python3']
1
type-of-triangle
MATH || Solution of type of triangle problem
math-solution-of-type-of-triangle-proble-5y7c
Approach\n- Triangle Properties - The sum of the length of the two sides of a triangle is greater than the length of the third side.\n\n# Complexity\n- Time com
tiwafuj
NORMAL
2024-03-19T15:26:42.387639+00:00
2024-04-06T08:53:15.214650+00:00
98
false
# Approach\n- Triangle Properties - The sum of the length of the two sides of a triangle is greater than the length of the third side.\n\n# Complexity\n- Time complexity: O(1) - as all algorithms require constant time \n\n- Space complexity: O(1) - as no extra space is requried\n\n# Code\n```\nclass Solution:\n def ...
2
0
['Array', 'Math', 'Sorting', 'Python3']
0
type-of-triangle
Simple If-else solution | Beginners Friendly | 💯% user's beat
simple-if-else-solution-beginners-friend-p76d
\n\n\n# Approach\nif nums[0]==nums[1]==nums[2]:\nThis line checks if all three sides of the triangle are equal, which would indicate an equilateral triangle.\nr
Pankaj_Tyagi
NORMAL
2024-02-04T11:38:50.175149+00:00
2024-02-05T09:49:36.409483+00:00
225
false
![Screenshot 2024-02-05 151637.png](https://assets.leetcode.com/users/images/f2544c6a-2633-4539-85c4-c1684a66c7dd_1707126469.3201203.png)\n\n\n# Approach\nif nums[0]==nums[1]==nums[2]:\nThis line checks if all three sides of the triangle are equal, which would indicate an equilateral triangle.\nreturn "equilateral"\n\n...
2
0
['Python', 'Python3']
1
type-of-triangle
✅✔️Simple Solution using Triangle Property ✈️✈️✈️
simple-solution-using-triangle-property-wztql
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
ajay_1134
NORMAL
2024-02-03T16:08:44.896827+00:00
2024-02-03T16:08:44.896922+00:00
61
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
['Math', 'C++']
0
type-of-triangle
a few solutions
a-few-solutions-by-claytonjwong-h416
Game Plan\n\n\uD83D\uDEAB We cannot form a triangle if the sum of the minimum two side lengths is less-than-or-equal-to the maximum side length.\n \'none\'\n\n\
claytonjwong
NORMAL
2024-02-03T16:02:04.901408+00:00
2024-02-03T16:56:01.381456+00:00
520
false
# Game Plan\n\n\uD83D\uDEAB We cannot form a triangle if the sum of the minimum two side lengths is less-than-or-equal-to the maximum side length.\n* `\'none\'`\n\n\u2705 Otherwise we return the type of triangle based on the **cardinality of the set of side lengths:**\n\n1. `\'equilateral\'`\n2. `\'isosceles\'`\n3. `\'...
2
0
['C++', 'Python3', 'Rust', 'Kotlin', 'JavaScript']
2
type-of-triangle
Easy Java Solution
easy-java-solution-by-krishn13-fu9z
IntuitionSchool Level Mathematics., if sum of any two sides is greater than the third one, then it is a valid triangle.Approach nums contains 3 values, denoting
krishn13
NORMAL
2025-03-16T07:36:45.644402+00:00
2025-03-16T07:36:45.644402+00:00
137
false
# Intuition <!-- Describe your first thoughts on how to solve this problem. --> School Level Mathematics., if sum of any two sides is greater than the third one, then it is a valid triangle. # Approach <!-- Describe your approach to solving the problem. --> 1. `nums` contains 3 values, denoting sides of the triangle.,...
1
0
['Java']
0
type-of-triangle
Java, Beats 100%
java-beats-100-by-sarn1-4igd
Code
Sarn1
NORMAL
2025-03-13T15:49:36.827493+00:00
2025-03-13T15:49:36.827493+00:00
32
false
# Code ```java [] class Solution { public String triangleType(int[] nums) { if (nums[0] + nums[1] <= nums[2] || nums[0] + nums[2] <= nums[1] || nums[1] + nums[2] <= nums[0]) return "none"; else if (nums[0] == nums[1] && nums[0] == nums[2]) return "equilateral"; else if (nums[0] == nums[1] |...
1
0
['Java']
0
type-of-triangle
Mastering Triangle Classification with C++ || Beats 100% || O(1) || Easy for beginners to understand
mastering-triangle-classification-with-c-3clb
IntuitionThe problem requires us to determine the type of triangle that can be formed from three given side lengths. The key conditions to check are:Triangle Va
GeekyRahul04
NORMAL
2025-02-26T15:09:05.910744+00:00
2025-02-26T15:09:05.910744+00:00
103
false
# Intuition The problem requires us to determine the type of triangle that can be formed from three given side lengths. The key conditions to check are: Triangle Validity: A triangle is only valid if the sum of any two sides is greater than the third side. This ensures the given lengths satisfy the Triangle Inequalit...
1
0
['Array', 'Math', 'Sorting', 'C++']
0
type-of-triangle
O(1) 🔥 c++
o1-c-by-varuntyagig-yxu5
Complexity Time complexity: O(1) Space complexity: O(1) Code
varuntyagig
NORMAL
2025-02-21T06:01:01.781593+00:00
2025-02-21T06:01:01.781593+00:00
93
false
# Complexity - Time complexity: $$O(1)$$ - Space complexity: $$O(1)$$ # Code ```cpp [] class Solution { public: string triangleType(vector<int>& nums) { if (nums[0] + nums[1] <= nums[2]) return "none"; if (nums[0] + nums[2] <= nums[1]) return "none"; if (nums[1] +...
1
0
['Ordered Set', 'C++']
0
type-of-triangle
Python soln with thorough explanation
python-soln-with-thorough-explaination-b-vint
IntuitionAfter reading the problem and to solve it efficiently. We can proceed with hashset.ApproachUpon deciding, We chose hashsets as they dont repeat the sam
9chaitanya11
NORMAL
2025-02-06T08:26:04.311667+00:00
2025-02-06T08:47:28.489430+00:00
69
false
# Intuition After reading the problem and to solve it efficiently. We can proceed with hashset. # Approach Upon deciding, We chose hashsets as they dont repeat the same value again. So, if a triangle has all three sides as {3,3,3}, the hashset will only store one 3. By which, we can conclude that the given triangle i...
1
0
['Python3']
0
type-of-triangle
3 LINES JAVA CODE BEATING 100%
3-lines-java-code-beating-100-by-arshi_b-zc23
Complexity Time complexity: O(1) Space complexity: O(1) Code
arshi_bansal
NORMAL
2025-01-09T07:54:04.905663+00:00
2025-01-09T07:54:04.905663+00:00
208
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 ```java [] class Solution{ public String triangleType(int[] nums){ if(nums[0]+nums[1]<=nums[2]||nums[1]+nums[2]<=nums[0]||nums[0...
1
0
['Java']
0
type-of-triangle
O(1) Python Solution Using Sets
o1-python-solution-using-sets-by-odysseu-7foa
IntuitionA set is list of distinct objects. So that can help observe how many sides are the same since a repeated side will be deleted and that could be observe
Odysseus_v01
NORMAL
2024-12-28T03:26:18.645132+00:00
2024-12-28T03:26:18.645132+00:00
116
false
# Intuition <!-- Describe your first thoughts on how to solve this problem. --> A set is list of distinct objects. So that can help observe how many sides are the same since a repeated side will be deleted and that could be observed in the length of the set. # Approach <!-- Describe your approach to solving the proble...
1
0
['Python3']
1
type-of-triangle
0 ms || BEATS 100%
0-ms-beats-100-by-deepakk2510-zxtc
Code
deepakk2510
NORMAL
2024-12-16T09:28:10.780815+00:00
2024-12-16T09:28:10.780815+00:00
197
false
\n# Code\n```cpp []\nclass Solution {\npublic:\n string triangleType(vector<int>& nums) {\n if((nums[0]==nums[1]) && (nums[1]==nums[2])) return "equilateral";\n sort(nums.begin(),nums.end()); \n if((nums[0]+nums[1])>nums[2]){\n if((nums[0]==nums[1]) || (nums[1]==nums[2]) || (nums[0]==...
1
0
['C++']
0
type-of-triangle
0ms very easy java code
0ms-very-easy-java-code-by-galani_jenis-zr9x
IntuitionApproachComplexity Time complexity: Space complexity: Code
Galani_jenis
NORMAL
2024-12-15T04:06:36.552956+00:00
2024-12-15T04:06:36.552956+00:00
165
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
['Java']
0
type-of-triangle
Very easy code 0ms 100% beat java code
very-easy-code-0ms-100-beat-java-code-by-ci2d
IntuitionApproachComplexity Time complexity: Space complexity: Code
Galani_jenis
NORMAL
2024-12-15T04:05:20.493141+00:00
2024-12-15T04:05:20.493141+00:00
88
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
['Java']
0
type-of-triangle
C++ Simple 4-line Solution
c-simple-4-line-solution-by-yehudisk-cw9a
Intuition\nSimply check all conditions.\n\n# Complexity\n- Time complexity: O(1)\n\n- Space complexity: O(1)\n\n# Code\ncpp []\nclass Solution {\npublic:\n s
yehudisk
NORMAL
2024-11-26T13:40:42.698245+00:00
2024-11-26T13:40:42.698328+00:00
70
false
# Intuition\nSimply check all conditions.\n\n# Complexity\n- Time complexity: O(1)\n\n- Space complexity: O(1)\n\n# Code\n```cpp []\nclass Solution {\npublic:\n string triangleType(vector<int>& nums) {\n if ((nums[0] + nums[1] <= nums[2]) || (nums[0] + nums[2] <= nums[1]) || (nums[1] + nums[2] <= nums[0])) re...
1
0
['C++']
0
type-of-triangle
Easy solution | 100% beats
easy-solution-100-beats-by-ravindran_s-t48c
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-11T05:17:27.144598+00:00
2024-11-11T05:17:27.144637+00:00
8
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...
1
0
['C++']
0
type-of-triangle
Type of Triangle
type-of-triangle-by-tejdekiwadiya-sr9b
Intuition\nThe problem requires determining the type of a triangle based on the lengths of its sides. A triangle can be categorized as:\n- Equilateral: All thre
tejdekiwadiya
NORMAL
2024-10-21T16:25:42.577915+00:00
2024-10-21T16:25:42.577940+00:00
74
false
# Intuition\nThe problem requires determining the type of a triangle based on the lengths of its sides. A triangle can be categorized as:\n- **Equilateral**: All three sides are equal.\n- **Isosceles**: Two sides are equal.\n- **Scalene**: All sides are different.\n- **None**: If the sides don\'t form a valid triangle....
1
0
['Array', 'Math', 'Sorting', 'Java']
0
type-of-triangle
Simplest logic!! 0ms runtime :)
simplest-logic-0ms-runtime-by-raana_01-2yzt
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
Raana_01
NORMAL
2024-10-20T07:09:49.882534+00:00
2024-10-20T07:09:49.882560+00:00
98
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
['Python3']
0
type-of-triangle
Easy Solution
easy-solution-by-shamnad_skr-x3i1
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
shamnad_skr
NORMAL
2024-09-18T11:43:10.966855+00:00
2024-09-18T11:43:10.966884+00:00
51
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', 'JavaScript']
0
type-of-triangle
PYTHON
python-by-kanvapuri_sai_praneetha-8tsx
Code\n\nclass Solution:\n def triangleType(self, nums: List[int]) -> str:\n if len(nums)==3 and nums[0]<nums[1]+nums[2] and nums[1]<nums[0]+nums[2] an
kanvapuri_sai_praneetha
NORMAL
2024-08-05T18:51:05.716653+00:00
2024-08-05T18:51:05.716689+00:00
64
false
# Code\n```\nclass Solution:\n def triangleType(self, nums: List[int]) -> str:\n if len(nums)==3 and nums[0]<nums[1]+nums[2] and nums[1]<nums[0]+nums[2] and nums[2]<nums[1]+nums[0]:\n if len(set(nums))==1:\n return "equilateral"\n elif len(set(nums))==2:\n r...
1
0
['Python3']
1
type-of-triangle
Python solution in easy steps
python-solution-in-easy-steps-by-shubhas-v07l
\n\nclass Solution:\n def triangleType(self, nums: List[int]) -> str:\n \n if nums[0] + nums[1] > nums[2] and nums[0] + nums[2] > nums[1] and n
Shubhash_Singh
NORMAL
2024-08-04T11:56:50.357419+00:00
2024-08-04T11:56:50.357453+00:00
14
false
\n```\nclass Solution:\n def triangleType(self, nums: List[int]) -> str:\n \n if nums[0] + nums[1] > nums[2] and nums[0] + nums[2] > nums[1] and nums[1] + nums[2] > nums[0]:\n if nums[0]==nums[1] and nums[1] == nums[2]:\n return "equilateral"\n elif nums[0] != nums[...
1
0
['Python3']
0
type-of-triangle
Easy Java / C++ Solution (😍100% Beats Runtime in Java) 😎😎 -> 😮😮
easy-java-c-solution-100-beats-runtime-i-629p
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n1. For "equilateral" tr
jeeleej
NORMAL
2024-07-26T18:30:04.573702+00:00
2024-07-26T18:30:04.573740+00:00
30
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n1. For `"equilateral"` triangle all size of triangle is same so **num[0]==nums[1]==nums[2]** is the condition for that.\n2. For `"isosceles"` triangle any two side of ...
1
0
['Array', 'C++', 'Java']
0
type-of-triangle
Simple Easy to Understand Java Code
simple-easy-to-understand-java-code-by-s-8mz1
Complexity\n- Time complexity:\nO(n)\n- Space complexity:\nO(1)\n# Code\n\nclass Solution {\n public String triangleType(int[] nums) {\n if(nums[0] ==
Saurabh_Mishra06
NORMAL
2024-06-24T12:53:33.379685+00:00
2024-06-24T12:53:33.379719+00:00
136
false
# Complexity\n- Time complexity:\nO(n)\n- Space complexity:\nO(1)\n# Code\n```\nclass Solution {\n public String triangleType(int[] nums) {\n if(nums[0] == nums[1] && nums[1] == nums[2]){\n return "equilateral";\n }\n if(nums[0] + nums[1] <= nums[2] || nums[1] + nums[2] <= nums[0] || ...
1
0
['Java']
0