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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
type-of-triangle | Best Java Submission for Logic ✅️🍀 | best-java-submission-for-logic-by-atharv-ddqf | Best Java Solution using If Else only\n\n\n**** | AtharvaKote81 | NORMAL | 2024-05-14T08:58:48.005224+00:00 | 2024-05-14T08:58:48.005260+00:00 | 29 | false | Best Java Solution using If Else only\n\n\n**** | 1 | 0 | [] | 0 |
type-of-triangle | Array destructure | array-destructure-by-phyapanchakpram-ovf7 | \nvar triangleType = function(nums) {\n [a,b,c]= nums;\n if((a+b)<=c || (b+c) <= a || (c+a) <= b) return \'none\'\n else if(a===b && b===c && c===a) re | phyapanchakpram | NORMAL | 2024-05-07T12:01:35.249763+00:00 | 2024-05-07T12:01:35.249796+00:00 | 10 | false | ```\nvar triangleType = function(nums) {\n [a,b,c]= nums;\n if((a+b)<=c || (b+c) <= a || (c+a) <= b) return \'none\'\n else if(a===b && b===c && c===a) return \'equilateral\'\n else if(a !== b && b !== c && c !== a) return \'scalene\'\n else return \'isosceles\'\n};\n``` | 1 | 0 | ['JavaScript'] | 0 |
type-of-triangle | image solution provide || 5++ language||c||java||javascript||c++||array|| | image-solution-provide-5-languagecjavaja-dgag | Approach\n Describe your approach to solving the problem. \n1. we sort the array then we check nums[0]+nums[1]>nums[2]if this condition is satisfy then we check | ANKITBI1713 | NORMAL | 2024-03-10T04:44:51.528527+00:00 | 2024-03-10T04:44:51.528549+00:00 | 616 | false | # Approach\n<!-- Describe your approach to solving the problem. -->\n1. we sort the array then we check nums[0]+nums[1]>nums[2]if this condition is satisfy then we check which type of triangle is given\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- ... | 1 | 0 | ['Array', 'Math', 'C', 'Python', 'C++', 'Java'] | 1 |
type-of-triangle | [TypeScript] Sort solution. No If-Then. | typescript-sort-solution-no-if-then-by-b-6dri | Complexity\nBiggest side must be strictly less then sum of two other.\n\n# Code\n\nconst triangleType = (nums: number[]): string => {\n const triangles = [\' | badnewz | NORMAL | 2024-03-08T17:46:05.735348+00:00 | 2024-03-08T17:46:05.735395+00:00 | 5 | false | # Complexity\nBiggest side must be *strictly* less then sum of two other.\n\n# Code\n```\nconst triangleType = (nums: number[]): string => {\n const triangles = [\'none\', \'equilateral\', \'isosceles\', \'scalene\'];\n nums.sort((a, b) => b - a);\n return triangles[nums[0] < nums[1] + nums[2] ? (new Set(nums)... | 1 | 0 | ['Math', 'TypeScript'] | 0 |
type-of-triangle | Concise Kotlin solution | concise-kotlin-solution-by-yuanruqian-rxcl | 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 | yuanruqian | NORMAL | 2024-02-27T21:49:15.529871+00:00 | 2024-02-27T21:49:15.529903+00:00 | 13 | false | # Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity: $$O(1)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(1)$$\n<!-- Add your space complexity here... | 1 | 0 | ['Kotlin'] | 0 |
type-of-triangle | Easy C // C++ // Java Solution Beats 100% | easy-c-c-java-solution-beats-100-by-edwa-y9aq | Intuition\n\nJava []\nclass Solution {\n public String triangleType(int[] nums) {\n int a = nums[0];\n int b = nums[1];\n int c = nums[2 | Edwards310 | NORMAL | 2024-02-10T13:31:28.281976+00:00 | 2024-02-10T13:31:28.282015+00:00 | 65 | false | # Intuition\n\n```Java []\nclass Solution {\n public String triangleType(int[] nums) {\n int a = nums[0];\n int b = nums[1];\n int c = nums[2];\n\n if (... | 1 | 0 | ['C', 'C++', 'Java'] | 0 |
type-of-triangle | Type Of Triangle 2 | type-of-triangle-2-by-suyog_30-hzhz | Intuition\n Describe your first thoughts on how to solve this problem. \nThe code checks whether the given lengths of sides form a valid triangle or not by veri | suyog_30 | NORMAL | 2024-02-08T18:13:39.739903+00:00 | 2024-02-08T18:13:39.739935+00:00 | 17 | false | # Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nThe code checks whether the given lengths of sides form a valid triangle or not by verifying the triangle inequality theorem. Then, it further checks for the type of triangle based on the equality of sides.\n# Approach\n<!-- Describe your... | 1 | 0 | ['Java'] | 0 |
type-of-triangle | Easy C++ Solution || Beats 100% ✅✅ | easy-c-solution-beats-100-by-abhi242-4vnv | Code\n\nclass Solution {\npublic:\n string triangleType(vector<int>& nums) {\n if(nums[0]>=(nums[1]+nums[2]) || nums[1]>=(nums[0]+ nums[2]) || nums[2] | Abhi242 | NORMAL | 2024-02-07T20:18:39.331283+00:00 | 2024-02-07T20:18:39.331306+00:00 | 16 | false | # Code\n```\nclass Solution {\npublic:\n string triangleType(vector<int>& nums) {\n if(nums[0]>=(nums[1]+nums[2]) || nums[1]>=(nums[0]+ nums[2]) || nums[2]>=(nums[0]+nums[1])){\n return "none";\n }\n if(nums[0]==nums[1] && nums[1]==nums[2]){\n return "equilateral";\n ... | 1 | 0 | ['C++'] | 0 |
type-of-triangle | ✅Beats 100.00% of users || Best Method🔥 || C# || Easy Explanation || Beginner Friendly🔥🔥🔥 | beats-10000-of-users-best-method-c-easy-c6cmy | Intuition\n- Problem: Determine the type of triangle that can be formed from three given side lengths.\n- Approach: Sort the lengths, check triangle inequality | Sayan98 | NORMAL | 2024-02-04T11:40:56.619509+00:00 | 2024-02-04T11:40:56.619535+00:00 | 87 | false | # Intuition\n- **Problem**: Determine the type of triangle that can be formed from three given side lengths.\n- **Approach**: Sort the lengths, check triangle inequality and side equality conditions to classify the triangle.\n\n$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:$$O(1)$$\n<!-- Add your space complexity here, ... | 1 | 0 | ['Array', 'Math', 'C++'] | 0 |
type-of-triangle | Simple with java using HashMap(100% Faster Solution). | simple-with-java-using-hashmap100-faster-jkmu | Intuition\n- When I understand this problem,Then firstly HashMap Data Structure was come to mind and then I started work with HashMap and I got better result;\ | shubh_hacker_01 | NORMAL | 2024-02-04T06:53:13.151874+00:00 | 2024-02-04T06:53:53.597310+00:00 | 15 | false | # Intuition\n- When I understand this problem,Then firstly HashMap Data Structure was come to mind and then I started work with HashMap and I got better result;\n\n# Approach\n- Take a HashMap and put all the possible sum of array with condition(as you are see in code).\n- Then check simply if map size is 1 then simpl... | 1 | 0 | ['Java'] | 0 |
type-of-triangle | C++ easy solution using hash table 🔥 | c-easy-solution-using-hash-table-by-hk34-tooc | Intuition\n Describe your first thoughts on how to solve this problem. \nwe have to check for properties -\n-> if equilateral triangle, all sides equal\n-> if i | hk342064 | NORMAL | 2024-02-04T06:51:09.042453+00:00 | 2024-02-04T06:51:09.042481+00:00 | 156 | false | # Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nwe have to check for properties -\n-> if equilateral triangle, all sides equal\n-> if isosceles triangle, two sides equal and sum of two sides are greater than third side\n-> if scalene triangle, none of the sides are equal and sum of two... | 1 | 0 | ['Hash Table', 'C++'] | 0 |
type-of-triangle | [JavaScript] - easy solution | javascript-easy-solution-by-qusinn-q3em | Complexity\n- Time complexity: O(1)\n- Space complexity: O(1)\n\n# Code\n\n/**\n * @param {number[]} nums\n * @return {string}\n */\nvar triangleType = function | qusinn | NORMAL | 2024-02-03T16:59:46.289374+00:00 | 2024-02-03T17:18:11.098379+00:00 | 107 | false | # Complexity\n- Time complexity: $$O(1)$$\n- Space complexity: $$O(1)$$\n\n# Code\n```\n/**\n * @param {number[]} nums\n * @return {string}\n */\nvar triangleType = function(nums) {\n nums.sort((a, b) => a - b);\n if (nums[0] + nums[1] <= nums[2]) {\n return \'none\';\n }\n if (nums[0] === nums[1] &&... | 1 | 0 | ['JavaScript'] | 0 |
type-of-triangle | Sort & Conditions!! | sort-conditions-by-hustle_code-3vlq | \nclass Solution {\npublic:\n string triangleType(vector<int>& nums) {\n sort(nums.begin(), nums.end());\n\n if (nums[0] + nums[1] > nums[2]) {\n | hustle_code | NORMAL | 2024-02-03T16:54:12.500500+00:00 | 2024-02-03T16:54:12.500520+00:00 | 105 | false | ```\nclass Solution {\npublic:\n string triangleType(vector<int>& nums) {\n sort(nums.begin(), nums.end());\n\n if (nums[0] + nums[1] > nums[2]) {\n if (nums[0] == nums[1] && nums[1] == nums[2]) {\n return "equilateral";\n } else if (nums[0] == nums[1] || nums[1] == nums[2]) {\n ... | 1 | 0 | ['C', 'Sorting'] | 0 |
type-of-triangle | Clean✓ Java Solution🔥||🔥LeetCode BiWeekly Challenges🔥 | clean-java-solutionleetcode-biweekly-cha-f460 | Complexity\n- Time complexity:O(sorting)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity:O(1)\n Add your space complexity here, e.g. O(n) \n\n | Shree_Govind_Jee | NORMAL | 2024-02-03T16:43:23.807319+00:00 | 2024-02-03T16:43:23.807345+00:00 | 126 | false | # Complexity\n- Time complexity:$$O(sorting)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:$$O(1)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n private boolean check(int[] nums){\n Arrays.sort(nums);\n return ((nums[0]+nums... | 1 | 0 | ['Java'] | 0 |
type-of-triangle | Short Code || HashSet || 1ms 🔥🔥|| Please upvote | short-code-hashset-1ms-please-upvote-by-gvq6f | Intuition\n Describe your first thoughts on how to solve this problem. \nThe problem appears to involve determining the type of triangle based on its side lengt | Satyam_Mishra_1 | NORMAL | 2024-02-03T16:43:22.239625+00:00 | 2024-02-03T16:43:22.239648+00:00 | 86 | false | # Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nThe problem appears to involve determining the type of triangle based on its side lengths. The code seems to check the validity of a triangle using the triangle inequality theorem and then identifies the type (equilateral, isosceles, or s... | 1 | 0 | ['Hash Table', 'Java'] | 0 |
type-of-triangle | ✅✅Easy to understand|| c++|| sorting | easy-to-understand-c-sorting-by-techsidh-m067 | 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 | techsidh | NORMAL | 2024-02-03T16:27:00.355313+00:00 | 2024-02-03T16:27:00.355342+00:00 | 90 | 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(nlogn)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:O(1)\n<!-- Add your space complexity here, e.g.... | 1 | 0 | ['Sorting', 'C++'] | 0 |
type-of-triangle | easy solution | beats 100% | easy-solution-beats-100-by-leet1101-j0jy | Code\n\nclass Solution {\npublic:\n string triangleType(vector<int>& nums) {\n if (nums[0] == nums[1] && nums[0] == nums[2]){\n return "equ | leet1101 | NORMAL | 2024-02-03T16:18:18.193161+00:00 | 2024-02-03T16:18:18.193196+00:00 | 28 | false | # Code\n```\nclass Solution {\npublic:\n string triangleType(vector<int>& nums) {\n if (nums[0] == nums[1] && nums[0] == nums[2]){\n return "equilateral" ;\n }\n else {\n if ((nums[0]+nums[1]>nums[2]) && (nums[1]+nums[2]>nums[0]) && (nums[0]+nums[2]>nums[1])){\n ... | 1 | 0 | ['C++'] | 0 |
type-of-triangle | Check Triangle Properties | C++ | check-triangle-properties-c-by-jay_1410-4wp6 | Code\n\nclass Solution {\npublic:\n string triangleType(vector<int>& nums){\n sort(nums.begin(),nums.end());\n if(nums[0] + nums[1] > nums[2]){ | Jay_1410 | NORMAL | 2024-02-03T16:12:30.602335+00:00 | 2024-02-03T16:12:30.602364+00:00 | 71 | false | # Code\n```\nclass Solution {\npublic:\n string triangleType(vector<int>& nums){\n sort(nums.begin(),nums.end());\n if(nums[0] + nums[1] > nums[2]){\n if(nums[0] == nums[1] && nums[1] == nums[2]) return "equilateral";\n if(nums[0] == nums[1] || nums[1] == nums[2]) return "isoscele... | 1 | 0 | ['C++'] | 0 |
type-of-triangle | JS || Solution by Bharadwaj | js-solution-by-bharadwaj-by-manu-bharadw-t2ab | Code\n\nvar triangleType = function (nums) {\n nums.sort((a, b) => a - b);\n if (nums[0] + nums[1] > nums[2]) {\n if (nums[0] === nums[1] && nums[1 | Manu-Bharadwaj-BN | NORMAL | 2024-02-03T16:09:31.379299+00:00 | 2024-02-03T16:09:31.379333+00:00 | 173 | false | # Code\n```\nvar triangleType = function (nums) {\n nums.sort((a, b) => a - b);\n if (nums[0] + nums[1] > nums[2]) {\n if (nums[0] === nums[1] && nums[1] === nums[2]) {\n return "equilateral";\n }\n else if (nums[0] === nums[1] || nums[1] === nums[2]) {\n return "isoscel... | 1 | 0 | ['JavaScript'] | 2 |
type-of-triangle | Simple java code 0 ms beats 100 % | simple-java-code-0-ms-beats-100-by-arobh-y30i | Complexity\n\n\n# Code\n\nclass Solution {\n public String triangleType(int[] nums) {\n if(nums[0]+nums[1]<=nums[2]||nums[0]+nums[2]<=nums[1]||nums[1] | Arobh | NORMAL | 2024-02-03T16:07:55.352236+00:00 | 2024-02-03T16:07:55.352277+00:00 | 4 | false | # Complexity\n\n\n# Code\n```\nclass Solution {\n public String triangleType(int[] nums) {\n if(nums[0]+nums[1]<=nums[2]||nums[0]+nums[2]<=nums[1]||nums[1]+nums[2]<=nums[0]){\n return "n... | 1 | 0 | ['Java'] | 0 |
type-of-triangle | Easy Solution in Java . | easy-solution-in-java-by-prajesh07-j4a2 | IntuitionApproachComplexity
Time complexity: O(1) .
Space complexity: O(1) .
Code | prajesh07 | NORMAL | 2025-04-07T17:36:29.652542+00:00 | 2025-04-07T17:36:29.652542+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: O(1) .
<!-- Add your time complexity here, e.g. $$O(n)$$ -->
- Space complexity: O(1) .
<!-- Add your space complexity here, e.g. $$O(n)$$... | 0 | 0 | ['Java'] | 0 |
type-of-triangle | Easy Solution in C++ . | easy-solution-in-c-by-prajesh07-95qn | IntuitionApproachComplexity
Time complexity: O(1) .
Space complexity: O(1) .
Code | prajesh07 | NORMAL | 2025-04-07T17:34:39.211071+00:00 | 2025-04-07T17:34:39.211071+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: O(1) .
<!-- Add your time complexity here, e.g. $$O(n)$$ -->
- Space complexity: O(1) .
<!-- Add your space complexity here, e.g. $$O(n)$$... | 0 | 0 | ['C++'] | 0 |
type-of-triangle | Easy Solution in C . | easy-solution-in-c-by-prajesh07-oz1b | IntuitionApproachComplexity
Time complexity: O(1) .
Space complexity: O(1) .
Code | prajesh07 | NORMAL | 2025-04-07T17:32:20.484511+00:00 | 2025-04-07T17:32:20.484511+00:00 | 2 | false | # Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
# Approach
<!-- Describe your approach to solving the problem. -->
# 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)$$... | 0 | 0 | ['C'] | 0 |
type-of-triangle | very simple c code | very-simple-c-code-by-sanjaykumar_chittu-sdzc | IntuitionApproachComplexity
Time complexity:
Space complexity:
Code | sanjaykumar_chitturi | NORMAL | 2025-04-05T06:37:36.509807+00:00 | 2025-04-05T06:37:36.509807+00:00 | 4 | 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 | ['C'] | 0 |
type-of-triangle | Beats 100% | Using Triangle Inequality Theorem | beats-100-using-triangle-inequality-theo-afuc | IntuitionApproachComplexity
Time complexity:
Space complexity:
Code | katedel28 | NORMAL | 2025-04-01T16:14:30.975186+00:00 | 2025-04-01T16:14:30.975186+00:00 | 2 | 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 |
type-of-triangle | One more task | one-more-task-by-pasha_iden-sguy | in two ways.Code | pasha_iden | NORMAL | 2025-03-31T16:22:43.155430+00:00 | 2025-03-31T16:22:43.155430+00:00 | 1 | false | in two ways.
# Code
```python []
class Solution(object):
def triangleType(self, nums):
if nums[0] == nums[1] == nums[2]:
return "equilateral"
else:
mi = min(nums)
nums.remove(mi)
av = min(nums)
nums.remove(av)
ma = nums[0]
... | 0 | 0 | ['Python'] | 0 |
type-of-triangle | Python | BEATS 100% | Simple If-else | python-beats-100-simple-if-else-by-saran-lrq7 | IntuitionApproachComplexity
Time complexity:
Space complexity:
Code | sarangrakhecha | NORMAL | 2025-03-29T05:05:38.322485+00:00 | 2025-03-29T05:05:38.322485+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 | ['Python3'] | 0 |
type-of-triangle | 100% working | 100-working-by-vishnukiran24-crcb | IntuitionApproachComplexity
Time complexity:
Space complexity:
Code | vishnukiran24 | NORMAL | 2025-03-28T16:20:02.646011+00:00 | 2025-03-28T16:20:02.646011+00:00 | 4 | 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 | ['C'] | 0 |
type-of-triangle | Easy To Understand | Beats 100% | O(1) | 0ms runtime | determine-triangle-type-equilateral-isos-r09r | IntuitionThe problem asks to determine the type of triangle (equilateral, isosceles, scalene) or check if a triangle is valid based on given side lengths.Approa | Srinivasanb07 | NORMAL | 2025-03-28T04:58:21.343279+00:00 | 2025-03-28T05:00:56.032905+00:00 | 3 | false | # Intuition
The problem asks to determine the type of triangle (equilateral, isosceles, scalene) or check if a triangle is valid based on given side lengths.
<!-- Describe your first thoughts on how to solve this problem. -->
# Approach
Sorting
Triangle Validity Check
Frequency Count:
<!-- Describe your approach to so... | 0 | 0 | ['Python3'] | 0 |
type-of-triangle | Easy Approach || Beginner's Code || O(1) | easy-approach-beginners-code-o1-by-prave-nzz7 | IntuitionApproachComplexity
Time complexity:
Space complexity:
Code | Praveen__Kumar__ | NORMAL | 2025-03-27T04:10:21.789503+00:00 | 2025-03-27T04:10:21.789503+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 | ['Math', 'Geometry', 'Java'] | 0 |
type-of-triangle | Readable Solution With Explanation | readable-solution-with-explanation-by-v1-bm1i | Sort nums to find longest side and return "none" if the values can not make a triangle (sum of smaller sides is <= greater side).
Count equal sides using for l | V1Nut | NORMAL | 2025-03-24T18:15:55.281044+00:00 | 2025-03-24T18:15:55.281044+00:00 | 1 | false | 1. Sort nums to find longest side and return "none" if the values can not make a triangle (sum of smaller sides is <= greater side).
2. Count equal sides using for loop with modulus to make it circular.
3. Return string based on how many sides are equivalent.
# Code
```kotlin []
class Solution {
fun triangleTyp... | 0 | 0 | ['Array', 'Math', 'Sorting', 'Kotlin'] | 0 |
type-of-triangle | ✅ Easy to understand || ✅0ms || 100% beats🔥|| Php | easy-to-understand-0ms-100-beats-php-by-mjbf6 | IntuitionThe problem requires identifying the type of triangle based on the given side lengths.
First, we need to check if the sides can form a valid triangle u | djupraity | NORMAL | 2025-03-24T17:45:44.018645+00:00 | 2025-03-24T17:45:44.018645+00:00 | 2 | false | # Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
The problem requires identifying the type of triangle based on the given side lengths.
First, we need to check if the sides can form a valid triangle using the **triangle inequality theorem**:
- `side1 + side2 > side3`
- `side1 + side3 > ... | 0 | 0 | ['PHP'] | 0 |
type-of-triangle | 100% beats easy c solution | 100-beats-easy-c-solution-by-kunsh2301-uok6 | IntuitionApproachComplexity
Time complexity:
Space complexity:
Code | kunsh2301 | NORMAL | 2025-03-24T14:22:49.209279+00:00 | 2025-03-24T14:22:49.209279+00:00 | 5 | 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 | ['C'] | 0 |
type-of-triangle | JAVA || Beginner Friendly || Easy to Understand || IF-ELSE Approach | java-beginner-friendly-easy-to-understan-l518 | ApproachCheck if the Given Sides Form a Valid Triangle (isTri function):
A valid triangle must satisfy the Triangle Inequality Theorem, which states that the s | hpathak875 | NORMAL | 2025-03-24T13:34:30.329661+00:00 | 2025-03-24T13:34:30.329661+00:00 | 2 | false |
# Approach
Check if the Given Sides Form a Valid Triangle (isTri function):
- A valid triangle must satisfy the Triangle Inequality Theorem, which states that the sum of the lengths of any two sides must be greater than the length of the third side.
- The method isTri(int[] arr) verifies this condition by checking:
... | 0 | 0 | ['Array', 'Math', 'Sorting', 'Java'] | 0 |
type-of-triangle | Types Of Triangle | types-of-triangle-by-jishabpatel-jyze | Code | Jishabpatel | NORMAL | 2025-03-23T16:51:17.770161+00:00 | 2025-03-23T16:51:17.770161+00:00 | 2 | false |
# Code
```java []
class Solution {
public String triangleType(int[] nums) {
int a = nums[0];
int b = nums[1];
int c = nums[2];
if(a+b>c && b+c>a && c+a>b){
if(a==b && b==c && c==a) return "equilateral";
if(a!=b && b!=c && c!=a) return "scalene";
... | 0 | 0 | ['Java'] | 0 |
type-of-triangle | Self Generated Solution | self-generated-solution-by-pranaykadu59-t3mu | IntuitionWe are given three side lengths and need to determine what type of triangle they form. A valid triangle must satisfy the triangle inequality rule (sum | pranaykadu59 | NORMAL | 2025-03-21T21:22:20.263959+00:00 | 2025-03-21T21:22:20.263959+00:00 | 2 | false | # Intuition
We are given three side lengths and need to determine what type of triangle they form. A valid triangle must satisfy the **triangle inequality rule** (sum of two smaller sides must be greater than the largest side). Based on side lengths, a triangle can be:
- **Equilateral** → All three sides are the same... | 0 | 0 | ['Java'] | 0 |
type-of-triangle | 0ms || JAVA || MOST BASIC CODE || SIMPLE TO UNDERSTAND..!!! | 0ms-java-most-basic-code-simple-to-under-8qji | IntuitionApproachComplexity
Time complexity:O(1)
Space complexity:
Code | Devesh_Agrawal | NORMAL | 2025-03-19T14:15:38.877558+00:00 | 2025-03-19T14:15:38.877558+00:00 | 3 | false | # Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
# Approach
<!-- Describe your approach to solving the problem. -->
# Complexity
- Time complexity:O(1)
<!-- Add your time complexity here, e.g. $$O(n)$$ -->
- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->
# Co... | 0 | 0 | ['Java'] | 0 |
type-of-triangle | Simple solution in Java. Beats 100 % | simple-solution-in-java-beats-100-by-kha-jza7 | Complexity
Time complexity:
O(1)
Space complexity:
O(1)
Code | Khamdam | NORMAL | 2025-03-16T04:49:53.806525+00:00 | 2025-03-16T04:49:53.806525+00:00 | 2 | false | # Complexity
- Time complexity:
O(1)
- Space complexity:
O(1)
# Code
```java []
class Solution {
public String triangleType(int[] nums) {
int a = nums[0];
int b = nums[1];
int c = nums[2];
if (a + b <= c || a + c <= b || c + b <= a) {
return "none";
} else {
... | 0 | 0 | ['Array', 'Java'] | 0 |
type-of-triangle | Using JAVA Beats 100% | using-java-beats-100-by-namannirwal0401-cig2 | IntuitionApproachComplexity
Time complexity:
Space complexity:
Code | namannirwal0401 | NORMAL | 2025-03-08T14:29:34.856969+00:00 | 2025-03-08T14:29:34.856969+00:00 | 3 | 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 | ['Java'] | 0 |
type-of-triangle | Easy code for beginners 100% beats | easy-code-for-beginners-100-beats-by-kri-1oi5 | IntuitionApproachComplexity
Time complexity:
Space complexity:
Code | kritee_2307 | NORMAL | 2025-03-06T10:23:25.393204+00:00 | 2025-03-06T10:23:25.393204+00:00 | 6 | 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 | ['Array', 'Math', 'C'] | 0 |
type-of-triangle | No if-else spaghetti and actually readable? | no-if-else-spaghetti-and-actually-readab-xeoj | IntuitionKeep count of which number appears most. Then use that count to determine the type of triangle.ApproachStore each number as a key in a map and assign t | nate-osterfeld | NORMAL | 2025-03-02T20:52:05.529660+00:00 | 2025-03-02T20:52:05.529660+00:00 | 2 | false | # Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
Keep count of which number appears most. Then use that count to determine the type of triangle.
# Approach
<!-- Describe your approach to solving the problem. -->
Store each number as a key in a map and assign the number of times it appear... | 0 | 0 | ['JavaScript'] | 0 |
type-of-triangle | JS solution with bubbleSort implementation | js-solution-with-bubblesort-implementati-ldcr | IntuitionApproachComplexity
Time complexity: O(n2)
Space complexity: O(1)
Code | bwnQYni8bB | NORMAL | 2025-02-28T11:41:12.090870+00:00 | 2025-02-28T11:41:12.090870+00:00 | 2 | false | # Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
# Approach
<!-- Describe your approach to solving the problem. -->
# Complexity
- Time complexity: $$O(n^2)$$
<!-- Add your time complexity here, e.g. $$O(n)$$ -->
- Space complexity: $$O(1)$$
<!-- Add your space complexity here, e.g. $$... | 0 | 0 | ['JavaScript'] | 0 |
type-of-triangle | IF | if-by-marcelo_kobayashi-ao8r | IntuitionApproachComplexity
Time complexity:
Space complexity:
Code | Marcelo_Kobayashi | NORMAL | 2025-02-26T20:05:41.167825+00:00 | 2025-02-26T20:05:41.167825+00:00 | 0 | 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 | ['Python'] | 0 |
type-of-triangle | 1. Easy to understand | 1-easy-to-understand-by-sonhandsome06-0yq2 | Approach
If it is triangle when 2 sides > remaining side.
I use for to update to Set. if size = 1: equilateral , size = 2: isosceles, size = 3: scalene
Complexi | sonhandsome06 | NORMAL | 2025-02-26T14:40:30.691252+00:00 | 2025-02-26T14:40:30.691252+00:00 | 3 | false |
# Approach
<!-- Describe your approach to solving the problem. -->
1. If it is triangle when 2 sides > remaining side.
2. I use for to update to Set. if size = 1: equilateral , size = 2: isosceles, size = 3: scalene
# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->
O(1)
- Space com... | 0 | 0 | ['Java'] | 0 |
type-of-triangle | C# | c-by-sahooalok-ljqr | IntuitionApproachComplexity
Time complexity:
Space complexity:
Code | sahooalok | NORMAL | 2025-02-21T03:07:17.557096+00:00 | 2025-02-21T03:07:17.557096+00:00 | 3 | 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 | ['C#'] | 0 |
type-of-triangle | EASY TO UNDERSTAND SOLUTION IN C++ | easy-to-understand-solution-in-c-by-le2j-oxdx | IntuitionApproach:The only properties you need to remember:
A Triangle can only be formed if some of ANY two sides is GREATER then the third side.
Equilateral T | Yadav_Tarun | NORMAL | 2025-02-20T17:20:56.629628+00:00 | 2025-02-20T17:20:56.629628+00:00 | 3 | false | # Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
# Approach:
The only properties you need to remember:
1. A Triangle can only be formed if some of ANY two sides is GREATER then the third side.
2. Equilateral Triangle: triangle having all 3 sides Equal.
3. Isoceles Triangle: Triangle hav... | 0 | 0 | ['C++'] | 0 |
type-of-triangle | Solved with O(1) time & space complexity beats 100%. | solved-with-o1-time-space-complexity-bea-939e | ScreenShotApproach
used else if ladder and check in in if condition check if any two sides sum is greater than 3 side then return "none".
in else if condition c | Vedant_Bachhav | NORMAL | 2025-02-18T13:59:34.944386+00:00 | 2025-02-18T13:59:34.944386+00:00 | 2 | false | # ScreenShot
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->
1. used else if ladder and check in in if condition chec... | 0 | 0 | ['Array', 'Math', 'Java'] | 0 |
type-of-triangle | Simple Maths | simple-maths-by-user3660l-mjxl | IntuitionApproachComplexity
Time complexity:
O(1)
Space complexity:
O(1)
Code | user3660L | NORMAL | 2025-02-14T10:50:25.151318+00:00 | 2025-02-14T10:50:25.151318+00:00 | 3 | false | # Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
# Approach
<!-- Describe your approach to solving the problem. -->
# Complexity
- Time complexity:
O(1)
- Space complexity:
O(1)
# Code
```cpp []
class Solution {
public:
string triangleType(vector<int>& nums) {
if(nums[0]+n... | 0 | 0 | ['C++'] | 0 |
type-of-triangle | VERY EASY SOLUTION IN C++ | very-easy-solution-in-c-by-cmacxssxua-htkf | IntuitionUSING SIMPLE MATHMATICAL LOGIC THE PROBLEM IS DONE.
FOR EQUILATERAL:ALL SIDES MUST BE OF SAME LENGTH
FOR SCALENE:ALL SIDES MUST BE OF DIFFERENT LENGTH | CmAcXSsxUa | NORMAL | 2025-02-12T16:29:08.380013+00:00 | 2025-02-12T16:31:59.501717+00:00 | 3 | false | # Intuition
USING SIMPLE MATHMATICAL LOGIC THE PROBLEM IS DONE.
FOR EQUILATERAL:ALL SIDES MUST BE OF SAME LENGTH
FOR SCALENE:ALL SIDES MUST BE OF DIFFERENT LENGTH
NOW IF ABOVE TWO CONDITIONS FAILED TO MEET THEN IT IS NOTHING BUT ISOSCELES.
NOTE:TO FORM A TRIANGLE WITH GIVEN LENGHT OF SIDES THE MAIN CRITERIA IS THAT "TH... | 0 | 0 | ['Math', 'C++'] | 0 |
type-of-triangle | Long but simple | Beats 100% | long-but-simple-by-stenpenny-3gdz | ApproachNot the best approach I am sure but it works!Code | stenpenny | NORMAL | 2025-02-11T21:37:14.128528+00:00 | 2025-02-11T21:37:45.960820+00:00 | 5 | false | # Approach
Not the best approach I am sure but it works!
# Code
```python3 []
class Solution:
def triangleType(self, nums: List[int]) -> str:
if nums[0] == nums[1] and nums[0] == nums[2]:
return "equilateral"
elif nums[0] == nums[1] and nums[0] + nums[1] > nums[2]:
return "i... | 0 | 0 | ['Python3'] | 0 |
type-of-triangle | PYTHON3 SOLUTION | python3-solution-by-saikaushik07-bm5d | IntuitionApproachComplexity
Time complexity:
Space complexity:
Code | Saikaushik07 | NORMAL | 2025-02-08T08:25:52.319330+00:00 | 2025-02-08T08:25:52.319330+00:00 | 4 | 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 | ['Python3'] | 0 |
type-of-triangle | 0 ms Beats 100.00% In JavaScript | 0-ms-beats-10000-in-javascript-by-agzam0-22oh | IntuitionApproachComplexity
Time complexity:
Space complexity:
Code | agzam06 | NORMAL | 2025-02-01T12:49:03.826794+00:00 | 2025-02-01T12:49:03.826794+00:00 | 4 | 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 |
type-of-triangle | JS Solution | Beats 100% | js-solution-beats-100-by-soumyakhanda-nf04 | Code | SoumyaKhanda | NORMAL | 2025-01-30T19:16:17.869919+00:00 | 2025-01-30T19:16:17.869919+00:00 | 7 | false | # Code
```javascript []
function triangleType(nums) {
const s1 = nums[0] + nums[1];
const s2 = nums[0] + nums[2];
const s3 = nums[1] + nums[2];
return isTriangle(nums[0], nums[1], nums[2]) ? getTriangleType(s1, s2, s3) : 'none';
};
function getTriangleType(s1, s2, s3) {
if (s1 === s2 && s2 === s3)
... | 0 | 0 | ['JavaScript'] | 0 |
type-of-triangle | Python Approach | python-approach-by-nirmal1234-9er0 | IntuitionApproachComplexity
Time complexity:
Space complexity:
Code | Nirmal_Manoj | NORMAL | 2025-01-30T17:16:19.860153+00:00 | 2025-01-30T17:16:19.860153+00:00 | 3 | 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 | ['Python3'] | 0 |
type-of-triangle | Easy solution 🧠 | easy-solution-by-ilhbqgglvs-82d0 | IntuitionApproachComplexity
Time complexity:
Space complexity:
Code | iLhbQGglVs | NORMAL | 2025-01-30T17:03:55.758562+00:00 | 2025-01-30T17:03:55.758562+00:00 | 4 | 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 | ['Java'] | 0 |
type-of-triangle | ✅✅Simple and 🚀Easy 💯💯 in JAVA | simple-and-easy-in-java-by-bojaadarsh-8648 | IntuitionApproachComplexity
Time complexity:
Space complexity:
Code | BojaAdarsh | NORMAL | 2025-01-30T16:58:20.637179+00:00 | 2025-01-30T16:58:20.637179+00:00 | 4 | 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 | ['Java'] | 0 |
type-of-triangle | Java O(1) solution with detailed explanation | java-o1-solution-with-detailed-explanati-czr2 | IntuitionWe need to check if a triangle exists and count amount of distinct sides.ApproachFirstly, we check if a triangle exist. We know that a triangle can not | had0uken | NORMAL | 2025-01-27T13:24:11.104243+00:00 | 2025-01-27T13:24:11.104243+00:00 | 3 | false | # Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
We need to check if a triangle exists and count amount of distinct sides.
# Approach
<!-- Describe your approach to solving the problem. -->
Firstly, we check if a triangle exist. We know that a triangle can not exit if sum of his any two ... | 0 | 0 | ['Java'] | 0 |
type-of-triangle | 3024. Type of Triangle | 3024-type-of-triangle-by-sohailtech-t5md | IntuitionWhen you want to determine the type of triangle from three given side lengths, the first thing is to check if the sides can even form a triangle. If th | SohailTech | NORMAL | 2025-01-27T11:07:22.175474+00:00 | 2025-01-27T11:07:22.175474+00:00 | 7 | false | # Intuition
When you want to determine the type of triangle from three given side lengths, the first thing is to check if the sides can even form a triangle. If they can, the type of triangle (equilateral, isosceles, or scalene) depends on whether the side lengths are equal or not.
# Approach
Validation:
To form a val... | 0 | 0 | ['C++'] | 0 |
type-of-triangle | PHP | php-by-shamilgadzhiev-74bi | Code | shamilGadzhiev | NORMAL | 2025-01-25T10:45:24.615405+00:00 | 2025-01-25T10:45:24.615405+00:00 | 2 | false | # Code
```php []
class Solution {
/**
* @param Integer[] $nums
* @return String
*/
function triangleType($nums) {
if (max($nums) >= array_sum($nums) - max($nums)){
return "none";
}
if ($nums[0] === $nums[1] && $nums[1] === $nums[2]){
retur... | 0 | 0 | ['PHP'] | 0 |
type-of-triangle | Easy c++ code | easy-c-code-by-ashutosh_soni14-9src | IntuitionApproachComplexity
Time complexity:
Space complexity:
Code | Ashutosh_soni14 | NORMAL | 2025-01-19T19:16:52.173518+00:00 | 2025-01-19T19:16:52.173518+00:00 | 6 | 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 | ['C++'] | 0 |
type-of-triangle | clean n structured solution !!! beats 100% user | clean-n-structured-solution-beats-100-us-n420 | IntuitionApproachComplexity
Time complexity:
Space complexity:
Code | deepesh_25 | NORMAL | 2025-01-15T07:45:48.724433+00:00 | 2025-01-15T07:45:48.724433+00:00 | 2 | 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 | ['Java'] | 0 |
count-anagrams | C++ Solution, Math with Explanation [Each step in detail] | c-solution-math-with-explanation-each-st-b023 | Explanation\n1. The basic idea is to multiply the number of ways to write each word.\n2. The number of ways to write a word of size n is n factorial i.e\xA0n!.\ | devanshu171 | NORMAL | 2022-12-24T19:16:35.379126+00:00 | 2022-12-26T11:06:31.179116+00:00 | 7,230 | false | # Explanation\n1. The basic idea is to multiply the number of ways to write each word.\n2. The number of ways to write a word of size n is `n factorial` i.e\xA0`n!`.\n3. For example *"abc" ->"abc","acb","bac","bca","cab","cba".* total 6 ways = 3!.\n3. Here we want total ***unique count***, so words like "aa" can be wri... | 63 | 1 | ['Math', 'C++'] | 8 |
count-anagrams | Multiply Permutations | multiply-permutations-by-votrubac-v5x8 | We count permutations of each word, and multiply those permutatons.\n\nThe number of permutations with repetitions is a factorial of word lenght, divided by fac | votrubac | NORMAL | 2022-12-24T22:42:12.491924+00:00 | 2022-12-24T23:18:36.468881+00:00 | 3,829 | false | We count permutations of each word, and multiply those permutatons.\n\nThe number of permutations with repetitions is a factorial of word lenght, divided by factorial of count of each character.\n\n**Python 3**\nPython developers are in luck due to `factorial` and large integer support.\n\n```python\nclass Solution:\n ... | 22 | 0 | ['C', 'Python'] | 4 |
count-anagrams | [Python] simple math | python-simple-math-by-pbelskiy-wb7t | Just use formula from school to get permutation number of each part.\nhttps://en.wikipedia.org/wiki/Permutation#k-permutations_of_n\n\npython\nclass Solution:\n | pbelskiy | NORMAL | 2022-12-24T16:48:30.879387+00:00 | 2023-01-03T10:35:49.002270+00:00 | 2,584 | false | Just use formula from school to get permutation number of each part.\nhttps://en.wikipedia.org/wiki/Permutation#k-permutations_of_n\n\n```python\nclass Solution:\n def countAnagrams(self, s: str) -> int:\n\n def get(word):\n n = math.factorial(len(word))\n\n for v in Counter(word).values... | 17 | 5 | ['Math', 'Python', 'Python3'] | 4 |
count-anagrams | Python 3 || 11 lines, w/ explanation || T/S: 96 % / 99% | python-3-11-lines-w-explanation-ts-96-99-ksuh | The problem reduces to finding the multinomial coefficient for each word and then returning their product as the answer. (The binomial coeficient is a particula | Spaulding_ | NORMAL | 2023-07-11T07:35:31.513149+00:00 | 2024-06-17T02:56:49.998502+00:00 | 681 | false | - The problem reduces to finding the *multinomial coefficient* for each word and then returning their product as the answer. (The *binomial coeficient* is a particular case of the multinomial coefficient.)\n\n- Unfortunately, computing each of these multinomial coefficients, because by definition they require factorial... | 14 | 0 | ['Python3'] | 0 |
count-anagrams | Easy to Understand Java Solution Permutations and Inverse Factorial | easy-to-understand-java-solution-permuta-7pdy | Intuition\n Describe your first thoughts on how to solve this problem. \nThe idea is how to calcuate number of permutations with duplicates.\n\n# Approach\n Des | jimkirk | NORMAL | 2022-12-24T18:19:48.281646+00:00 | 2023-04-16T19:44:34.112645+00:00 | 2,215 | false | # Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nThe idea is how to calcuate number of permutations with duplicates.\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nFor string such as "AAABBCCD", the length of string is 8, and has 3 \'A\'s, 2 \'B\'s, 2 \'C\'s, an... | 10 | 0 | ['Combinatorics', 'Java'] | 2 |
count-anagrams | C++ Solution | c-solution-by-pranto1209-ni6a | Intuition\n Describe your first thoughts on how to solve this problem. \n Calculate the number of permutations of each word,\n Formula is: N! / (Ma! * Mb! | pranto1209 | NORMAL | 2022-12-24T17:28:46.580815+00:00 | 2023-03-14T08:13:39.187103+00:00 | 1,843 | false | # Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n Calculate the number of permutations of each word,\n Formula is: N! / (Ma! * Mb! * ... * Mz!)\n where N is the amount of letters in the word, and \n Ma, Mb, ..., Mz are the occurrences of repeated letters in the word. \n E... | 9 | 0 | ['C++'] | 3 |
count-anagrams | C++ Euclidean algorithm modular Inverse& Factorials||12ms beats 100% | c-euclidean-algorithm-modular-inverse-fa-dzgz | Intuition\n Describe your first thoughts on how to solve this problem. \nReal math solution is solved by Number theoretical trick, Modular Inverse.\nLet $w$ den | anwendeng | NORMAL | 2024-02-06T07:02:43.411925+00:00 | 2024-02-06T09:42:26.853422+00:00 | 357 | false | # Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nReal math solution is solved by Number theoretical trick, Modular Inverse.\nLet $w$ denote a word in the string `s` with length $len(w)$ & frequency table\nfreq(w)=$(w_{0}, w_1\\cdots w_{25})$\nThen the answer is\n$$\nans=\\Pi_{w\\in s}\... | 6 | 0 | ['Math', 'Combinatorics', 'Counting', 'Number Theory', 'C++'] | 0 |
count-anagrams | [Java] multiply Anagrams of every strings | java-multiply-anagrams-of-every-strings-qjdjy | Code\njava\nclass Solution {\n long mod = (long) 1e9+7;\n public int countAnagrams(String s) {\n int n = s.length();\n long[] fact = new lon | virendra115 | NORMAL | 2022-12-24T18:02:39.074506+00:00 | 2022-12-24T18:15:03.514572+00:00 | 1,863 | false | # Code\n```java\nclass Solution {\n long mod = (long) 1e9+7;\n public int countAnagrams(String s) {\n int n = s.length();\n long[] fact = new long[n+1];\n fact[0] = 1L;\n for(int i=1;i<=n;i++){\n fact[i] = fact[i-1]*i%mod;\n }\n String[] str = s.split(" ");\n ... | 6 | 0 | ['Java'] | 2 |
count-anagrams | c++ solution | c-solution-by-dilipsuthar60-oalm | \nclass Solution {\npublic:\n using ll =long long;\n ll mod=1e9+7;\n ll fact[100005];\n ll power(ll a,ll b)\n {\n ll res=1;\n while | dilipsuthar17 | NORMAL | 2022-12-24T17:04:17.453465+00:00 | 2022-12-24T17:04:17.453528+00:00 | 1,600 | false | ```\nclass Solution {\npublic:\n using ll =long long;\n ll mod=1e9+7;\n ll fact[100005];\n ll power(ll a,ll b)\n {\n ll res=1;\n while(b)\n {\n if(b&1)\n {\n res=(res*a)%mod;\n }\n a=(a*a)%mod;\n b/=2;\n }\n... | 6 | 0 | ['Math', 'C', 'C++'] | 1 |
count-anagrams | [C++|Java|Python3] multinomial coefficients | cjavapython3-multinomial-coefficients-by-ggo3 | Please pull this commit for solutions of biweekly 94. \n\nIntuition\nOn the math level, this is basically a test of multinomial coeffcients. The tricky part lie | ye15 | NORMAL | 2022-12-24T16:59:04.818730+00:00 | 2022-12-24T18:29:33.133224+00:00 | 2,746 | false | Please pull this [commit](https://github.com/gaosanyong/leetcode/commit/3ffc910c12ff8c84890fb15351216a0fa85dc3ac) for solutions of biweekly 94. \n\n**Intuition**\nOn the math level, this is basically a test of multinomial coeffcients. The tricky part lies in the implementation. \n**C++**\n```\nclass Solution {\npublic:... | 6 | 0 | ['C', 'Java', 'Python3'] | 3 |
count-anagrams | C++ || FACTORIAL AND THEIR INVERSE (Mathematics) (Easy to Understand) | c-factorial-and-their-inverse-mathematic-v5cd | Explanation:\nAns is multiplication of nos of different permutations of all words in the given string\n\nExample:\n\nsuppose the given string is "abc bcd ffa"\n | amitkumaredu | NORMAL | 2022-12-24T16:50:56.811139+00:00 | 2022-12-24T17:27:47.651890+00:00 | 1,726 | false | Explanation:\nAns is multiplication of nos of different permutations of all words in the given string\n\nExample:\n\nsuppose the given string is "abc bcd ffa"\nwe can write abc in 6 ways\nbcd in 6 ways\nsimilarly ffa in 3 ways (ffa,faf,aff)\ntotal no of different strings that can be produced\nwe have 3 positions\n"___ ... | 5 | 1 | ['Math', 'String', 'Combinatorics'] | 2 |
count-anagrams | Best Solution for Arrays, DP, String 🚀 in C++, Python and Java || 100% working | best-solution-for-arrays-dp-string-in-c-x87fw | 💡 IntuitionFor each word, count the permutations by dividing the factorial of its length by the factorials of the frequencies of its characters. Use modular ari | BladeRunner150 | NORMAL | 2025-01-10T06:46:59.554924+00:00 | 2025-01-10T06:46:59.554924+00:00 | 367 | false | # 💡 Intuition
For each word, count the permutations by dividing the factorial of its length by the factorials of the frequencies of its characters. Use modular arithmetic to handle large numbers. 🚀
# 🔮 Approach
1. Put all numbers in a HashSet (removes duplicates automatically)
2. Loop from 1 to n
3. If number isn'... | 4 | 0 | ['Hash Table', 'Math', 'String', 'Combinatorics', 'Counting', 'Python', 'C++', 'Java', 'Python3'] | 1 |
count-anagrams | Math + combinatorics [EXPLAINED] | math-combinatorics-explained-by-r9n-78yt | IntuitionI noticed that the problem is about finding how many ways we can rearrange the letters of each word while keeping the words in their original positions | r9n | NORMAL | 2024-12-27T03:57:11.220880+00:00 | 2024-12-27T03:57:11.220880+00:00 | 63 | false | # Intuition
I noticed that the problem is about finding how many ways we can rearrange the letters of each word while keeping the words in their original positions. Since we only care about permutations of the letters in each word, I focused on counting all unique arrangements for every word separately.
# Approach
Bre... | 4 | 0 | ['Hash Table', 'Math', 'String', 'Combinatorics', 'Counting', 'Rust'] | 0 |
count-anagrams | Super short simple Python Solution || Dictionaries and Math.factorial | super-short-simple-python-solution-dicti-fk1o | Intuition\n Describe your first thoughts on how to solve this problem. \nThe idea is very simple. Total count of anagrams for each word is\n(factorial of length | u-day | NORMAL | 2023-02-01T05:33:22.721355+00:00 | 2023-02-01T05:33:22.721410+00:00 | 294 | false | # Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nThe idea is very simple. Total count of anagrams for each word is\n(factorial of length of word) divided by factorial of duplicates.\n\nEg : aabbc - 5!/(2! * 2!)\n\n# Code\n```\nmod = 10**9+7\n\nclass Solution:\n def countAnagrams(sel... | 4 | 0 | ['Python3'] | 0 |
count-anagrams | Java build-in method to calc mod inverse | java-build-in-method-to-calc-mod-inverse-kpud | Intuition\nAssuming you have already known that a / b != (a % mod) / (b % mod)\n(Division is not allowed as a modular arithmetic operation.) \nOne of the approc | Vegetablebirds | NORMAL | 2022-12-26T16:52:08.561666+00:00 | 2022-12-26T16:52:08.561708+00:00 | 1,192 | false | # Intuition\nAssuming you have already known that a / b != (a % mod) / (b % mod)\n(Division is not allowed as a modular arithmetic operation.) \nOne of the approches to handle this problme is using inverse multiplication.)\n\nkudos to this post: https://leetcode.cn/problems/count-anagrams/solution/java-cheng-fa-ni-yuan... | 4 | 0 | ['Java'] | 0 |
count-anagrams | [Python3] Math (combinatorics) | python3-math-combinatorics-by-xil899-45tq | Code\n\nclass Solution:\n def countAnagrams(self, s: str) -> int:\n MOD = 10 ** 9 + 7\n ans = 1\n for word in s.split():\n an | xil899 | NORMAL | 2022-12-24T21:47:04.857870+00:00 | 2022-12-24T21:47:20.841189+00:00 | 471 | false | # Code\n```\nclass Solution:\n def countAnagrams(self, s: str) -> int:\n MOD = 10 ** 9 + 7\n ans = 1\n for word in s.split():\n ans = (ans * self.count(word)) % MOD\n return ans\n \n def count(self, word):\n n = len(word)\n ans = 1\n for f in ... | 4 | 0 | ['Math', 'Combinatorics', 'Python3'] | 2 |
count-anagrams | C++ || FACTORIAL | c-factorial-by-ganeshkumawat8740-382i | calculate no of possible combinarion of each word and than multiplay each calculated ans of each word.\n# Code\n\nclass Solution {\npublic:\n int modin(int x | ganeshkumawat8740 | NORMAL | 2023-05-25T10:51:30.065956+00:00 | 2023-05-25T10:51:30.066002+00:00 | 2,359 | false | calculate no of possible combinarion of each word and than multiplay each calculated ans of each word.\n# Code\n```\nclass Solution {\npublic:\n int modin(int x){\n int k = 1e9+5, mod = 1e9+7,ans = 1;\n while(k){\n if(k&1){\n ans = (ans*1LL*x)%mod;\n }\n ... | 3 | 0 | ['Hash Table', 'Math', 'String', 'Combinatorics', 'C++'] | 0 |
count-anagrams | Fast C++ soln | Maths explained | O(n) TC | fast-c-soln-maths-explained-on-tc-by-arj-f9ld | Intuition\nFor a given string, the answer can be found separately for each word in the string and multiplying over all words (from fundamental counting principl | arjunp0710 | NORMAL | 2022-12-25T03:56:51.729919+00:00 | 2022-12-25T03:56:51.729946+00:00 | 638 | false | # Intuition\nFor a given string, the answer can be found separately for each word in the string and multiplying over all words (from fundamental counting principle)\n\nFor each word, again use the counting principle. For ex: given a word `abbccd`\nthe number of anagrams is the number of permutations of this string -\n$... | 3 | 0 | ['Math', 'Memoization', 'C++'] | 1 |
count-anagrams | C++ Solution✅ | Detailed Explanation ⭐️ | c-solution-detailed-explanation-by-f_in_-77gp | Intuition\n Describe your first thoughts on how to solve this problem. \nThe problems essentially asks us to find the number of distinct permutations for the en | f_in_the_chat | NORMAL | 2022-12-24T17:15:35.467141+00:00 | 2022-12-24T17:15:35.467198+00:00 | 573 | false | # Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nThe problems essentially asks us to find the number of distinct permutations for the entire string. \n\nThis boils down to finding the number of distinct permuations of each word in the string and multiplying them to get total number of p... | 3 | 0 | ['C++'] | 0 |
count-anagrams | C++ || Math || Modulo Multiplicative Inverse || Permutations | c-math-modulo-multiplicative-inverse-per-z3rn | Here, for all words we can find distinct permutations and than for distinct permutations for whole string we have to multiply all distinct permutations that can | krunal_078 | NORMAL | 2022-12-24T16:52:35.341643+00:00 | 2022-12-24T17:39:31.365011+00:00 | 2,057 | false | * Here, for all words we can find distinct permutations and than for distinct permutations for whole string we have to multiply all distinct permutations that can be made from each words.\n* For `too` there are three possible permutations `1.too 2. oot 3. oto` .\n* For finding distinct permutations ,` n! / r1! * r2! .... | 3 | 0 | ['Math', 'C'] | 3 |
count-anagrams | PYTHON || FACTORIAL|| SIMPLE SOLUTION USING HASHMAP | python-factorial-simple-solution-using-h-y491 | 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 | Panda_606 | NORMAL | 2023-11-22T08:59:51.510627+00:00 | 2023-11-22T08:59:51.510656+00:00 | 583 | false | # Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ --... | 2 | 0 | ['Python3'] | 1 |
count-anagrams | Simple python3 Solution || Explained code | simple-python3-solution-explained-code-b-x85m | Intuition\nCode explained in comments.\n\n# Code\n\n#from itertools import permutations\nclass Solution:\n def countAnagrams(self, s: str) -> int:\n m | Priyanka0505 | NORMAL | 2023-06-15T21:27:54.494813+00:00 | 2023-06-15T21:27:54.494844+00:00 | 224 | false | # Intuition\nCode explained in comments.\n\n# Code\n```\n#from itertools import permutations\nclass Solution:\n def countAnagrams(self, s: str) -> int:\n mod= 10**9 + 7\n #splitting the words of string s in list w\n w=s.split(" ")\n a=[]\n #then iterating the words in list and appe... | 2 | 0 | ['Python3'] | 0 |
count-anagrams | easy solution with modular inverse, stringstream | easy-solution-with-modular-inverse-strin-s2k4 | 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 | minuszk4 | NORMAL | 2023-06-10T11:21:02.597250+00:00 | 2023-06-10T11:21:02.597282+00:00 | 178 | 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 | ['Hash Table'] | 1 |
count-anagrams | Modular Arithmetic | Inverse Modulo | Explanation with comments | modular-arithmetic-inverse-modulo-explan-iee2 | \nclass Solution\n{\n\tlong long binExpo(long long a, long long b, long long m)\n\t{\n\t\tif (b == 0)\n\t\t{\n\t\t\treturn 1;\n\t\t}\n\t\tlong long ans = binExp | aksh_mangal | NORMAL | 2023-04-23T18:19:42.654830+00:00 | 2023-04-23T18:20:10.617052+00:00 | 527 | false | ```\nclass Solution\n{\n\tlong long binExpo(long long a, long long b, long long m)\n\t{\n\t\tif (b == 0)\n\t\t{\n\t\t\treturn 1;\n\t\t}\n\t\tlong long ans = binExpo(a, b / 2, m);\n\t\tans = (ans * ans) % m;\n\t\tif (b & 1)\n\t\t{\n\t\t\tans = (ans * a) % m;\n\t\t}\n\t\treturn ans;\n\t}\n\npublic:\n\tint countAnagrams(s... | 2 | 0 | ['Math', 'String', 'Combinatorics', 'Counting', 'C++'] | 0 |
count-anagrams | C++ || TIME O(n),SPACE(n) || MULTIPLY PERMUTATION || SHORT & SWEET CODE | c-time-onspacen-multiply-permutation-sho-r07n | /\nlets a substring is aaabbbcc\nso ans for this \n 8!/(3!3!2!)\n/\n\nclass Solution {\npublic:\n int getinverse(long long int a,int b,int c){\n | yash___sharma_ | NORMAL | 2023-04-13T10:12:18.099211+00:00 | 2023-04-13T10:12:35.258205+00:00 | 1,423 | false | /*\nlets a substring is aaabbbcc\nso ans for this \n 8!/(3!*3!*2!)\n*/\n````\nclass Solution {\npublic:\n int getinverse(long long int a,int b,int c){\n long long int ans = 1;\n while(b){\n if(b&1){\n ans = (ans*a)%c;\n }\n a = (a*a)%c;\n ... | 2 | 0 | ['Math', 'String', 'C', 'C++'] | 1 |
count-anagrams | [scala] - modulo arithmetic step by step guide | scala-modulo-arithmetic-step-by-step-gui-p239 | Intuition\nIn order to count anagrams we should count permutations of letters for each word and multiply them. Permutations are computed with factorial. The sim | nikiforo | NORMAL | 2023-01-18T17:16:15.876715+00:00 | 2023-01-18T17:16:15.876762+00:00 | 48 | false | # Intuition\nIn order to count anagrams we should count permutations of letters for each word and multiply them. Permutations are computed with factorial. The simplest solution looks like this:\n\n```scala\nval m = 1000000007\n\ndef countAnagrams(s: String): Int = {\n val wordCounts = s.split(\' \').map { word =>\n ... | 2 | 0 | ['Scala'] | 0 |
count-anagrams | easy python solution | easy-python-solution-by-ashok0888-gtmy | \ndef countAnagrams(self, s: str) -> int:\n res=1\n for i in s.split():\n a=Counter(i)\n l=factorial(len(i))\n \n | ashok0888 | NORMAL | 2023-01-09T14:39:48.371075+00:00 | 2023-01-09T14:39:48.371117+00:00 | 415 | false | ```\ndef countAnagrams(self, s: str) -> int:\n res=1\n for i in s.split():\n a=Counter(i)\n l=factorial(len(i))\n \n for k,v in a.items():\n l=l//factorial(v)\n res=(res*l)\n return res%((10**9)+7)\n``` | 2 | 0 | [] | 0 |
count-anagrams | Python Elegant & Short | One line) | python-elegant-short-one-line-by-kyrylo-kun0r | If you like this solution remember toupvote itto let me know. | Kyrylo-Ktl | NORMAL | 2023-01-04T17:41:21.431301+00:00 | 2025-02-18T10:56:48.978810+00:00 | 491 | false | ```python []
from collections import Counter
from math import perm, prod
class Solution:
def countAnagrams(self, string: str) -> int:
count = 1
for word in string.split():
count *= perm(len(word)) // prod(map(perm, Counter(word).values()))
count %= 1_000_000_007
r... | 2 | 0 | ['Combinatorics', 'Python', 'Python3'] | 0 |
count-anagrams | modulo multiplicative inverse using binary exponentiation easy c++ solution | modulo-multiplicative-inverse-using-bina-kati | \n// modulo multiplicative inverse using binary exponentiation for better understanding\n//https://youtu.be/Gd9w8m-klho\n# Code\n\nusing ll=long long;\nclass So | aashi__70 | NORMAL | 2022-12-26T10:20:33.064480+00:00 | 2023-01-29T10:36:01.350206+00:00 | 273 | false | \n// modulo multiplicative inverse using binary exponentiation for better understanding\n//https://youtu.be/Gd9w8m-klho\n# Code\n```\nusing ll=long long;\nclass Solution {\npublic:\nconst int N=1e5+1;\n ll mod=1e9+7;\n vector<ll> precompute;\n ll temp=1;\n void fun(){\n for(int i=1;i<N;i++){\n ... | 2 | 0 | ['C++'] | 0 |
count-anagrams | [C++] Division with prime modulo 10^9+7 Solution Explained. | c-division-with-prime-modulo-1097-soluti-hi73 | Formula for factorial\n4! = 1 x 2 x 3 x 4\n\nFormula for permutations.\nFor permutations of "cccbhbq", "c" is repeated 3 times and "b" is repeated 2 times. Ther | pr0d1g4ls0n | NORMAL | 2022-12-24T17:09:06.409543+00:00 | 2022-12-24T18:23:20.724609+00:00 | 549 | false | **Formula for factorial**\n4! = `1 x 2 x 3 x 4`\n\n**Formula for permutations.**\nFor permutations of "cccbhbq", "c" is repeated 3 times and "b" is repeated 2 times. There are 7 total characters. Therefore, calculation for the permutations is `7! / (3! * 2!)`.\n\n**For dividing with prime modulo:**\n`a / b` == `a * b^(... | 2 | 0 | [] | 1 |
count-anagrams | Python3 counting & functional programming | python3-counting-functional-programming-tnb67 | Approach
For each word, count arrangements of all letters.
Also count arrangements of each repeated letter.
Divide (1) by the product of (2) to drop all non-uni | mattbain | NORMAL | 2025-02-19T18:46:39.493384+00:00 | 2025-02-21T04:56:15.013892+00:00 | 81 | false | Approach
--------
1. For each word, count arrangements of all letters.
2. Also count arrangements of each repeated letter.
3. Divide (1) by the product of (2) to drop all non-unique options.
4. Return the product of unique arrangements across words.
# Code
```python3 []
from operator import mul
from math import factor... | 1 | 0 | ['Python3'] | 0 |
count-anagrams | ✅☑️ Java Solution || Count-anagrams || Using Fermat's Little Theorem | java-solution-count-anagrams-using-ferma-taup | mul(long a, long b): Performs multiplication (a * b) % mod in a way that handles large numbers by taking the modulo at each step.\n\nbinaryExpo(long a, long n): | sajal_pandey | NORMAL | 2024-04-11T09:09:34.034476+00:00 | 2024-04-11T09:09:34.034511+00:00 | 101 | false | **mul(long a, long b):** Performs multiplication (a * b) % mod in a way that handles large numbers by taking the modulo at each step.\n\n**binaryExpo(long a, long n):** Implements binary exponentiation to efficiently calculate a^n % mod. This method reduces the computational complexity by halving n at each recursive st... | 1 | 0 | ['Number Theory', 'Java'] | 0 |
count-anagrams | Beats 100% in time and memory, the fastest solution | beats-100-in-time-and-memory-the-fastest-01di | Approach\nTo get the number of anagrams of the entire string, we need to calculate the number of anagrams of each word and multiply them.\nTo calculate the numb | andigntv | NORMAL | 2024-02-12T23:14:54.425620+00:00 | 2024-02-12T23:19:06.349414+00:00 | 38 | false | # Approach\nTo get the number of anagrams of the entire string, we need to calculate the number of anagrams of each word and multiply them.\nTo calculate the number of anagrams of one particular word, we can use the multinomial coefficient:\n {\n if (n == 0 || n == 1) {\n retur | Ashwani2529 | NORMAL | 2024-02-05T19:24:19.023177+00:00 | 2024-02-05T19:24:19.023211+00:00 | 301 | false | # Code\n```C++ []\nclass Solution {\npublic:\n long long mod = 1000000007;\n\n long long factorial(int n) {\n if (n == 0 || n == 1) {\n return 1;\n }\n long long result = 1;\n for (int num = 2; num <= n; num++) {\n result = (result * num) % mod;\n }\n ... | 1 | 0 | ['Python', 'C++', 'Python3'] | 1 |
count-anagrams | JAVA Solve | java-solve-by-feedwastfeed-1tj5 | \n# Code\n\nclass Solution {\n private static final int MOD = 1000000007;\n public int countAnagrams(String s) {\n long res=1;\n String stri | Feedwastfeed | NORMAL | 2023-02-05T20:40:12.951690+00:00 | 2023-02-05T20:40:12.951759+00:00 | 187 | false | \n# Code\n```\nclass Solution {\n private static final int MOD = 1000000007;\n public int countAnagrams(String s) {\n long res=1;\n String stringList [] = s.split(" ");\n for(int i=0 ; i<stringList.length; i++){\n long x = countChar(stringList[i]);\n long y = p(stringLis... | 1 | 0 | ['Java'] | 0 |
count-anagrams | c++ solution by counting the prime numbers | c-solution-by-counting-the-prime-numbers-oplq | Intuition\n1. Given a number n, it is not very hard to calculate all the primes less than n and therefore, it is also easy to find out the power of a prime numb | gc2021 | NORMAL | 2023-01-15T04:27:49.324097+00:00 | 2023-01-15T04:27:49.324124+00:00 | 160 | false | # Intuition\n1. Given a number n, it is not very hard to calculate all the primes less than n and therefore, it is also easy to find out the power of a prime number for n!\n2. To calculate n!/k!, it is equal to caculate the difference of the power of prime numbers of n! and k!. \n\n# Approach\n1. For any given word, ca... | 1 | 0 | ['C++'] | 1 |
count-anagrams | [Javascript] modular multiplicative inverse | javascript-modular-multiplicative-invers-wvts | Using modular multiplicative inverse formula found on internet https://cp-algorithms.com/algebra/module-inverse.html\n\n\n/**\n * @param {string} s\n * @return | aexg | NORMAL | 2023-01-07T08:02:10.978867+00:00 | 2023-01-07T08:02:10.978917+00:00 | 249 | false | Using modular multiplicative inverse formula found on internet https://cp-algorithms.com/algebra/module-inverse.html\n\n```\n/**\n * @param {string} s\n * @return {number}\n */\nvar countAnagrams = function (s) {\n let result = 1n;\n const MODULO = 1000000007n;\n\n // precompute factorials\n const facts = new Array... | 1 | 0 | ['JavaScript'] | 0 |
count-anagrams | Swift version: modular inverse | swift-version-modular-inverse-by-tzef-rf5i | Intuition\n Describe your first thoughts on how to solve this problem. \nGreat explanation please refer\nhttps://leetcode.com/problems/count-anagrams/solutions/ | tzef | NORMAL | 2022-12-30T17:04:41.136048+00:00 | 2022-12-30T17:05:29.317215+00:00 | 62 | false | # Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nGreat explanation please refer\nhttps://leetcode.com/problems/count-anagrams/solutions/2947111/c-solution-math-with-explanation-each-step-in-detail/?orderBy=most_votes\n\nAdd on reference for Fermat\'s little theorem\nhttps://en.wikipedia... | 1 | 0 | ['Swift'] | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.