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
shortest-impossible-sequence-of-rolls
1 + Number of K windows
1-number-of-k-windows-by-vats_lc-684t
Code
vats_lc
NORMAL
2024-12-29T07:56:44.335074+00:00
2024-12-29T07:56:44.335074+00:00
2
false
# Code ```cpp [] class Solution { public: int shortestSequence(vector<int>& rolls, int k) { int n = rolls.size(), ans = 0; set<int> st; for (int i = 0; i < n; i++) { st.insert(rolls[i]); if (st.size() == k) { ans++; st.clear(); ...
0
0
['C++']
0
shortest-impossible-sequence-of-rolls
Easiest O(N) Python solution
easiest-on-python-solution-by-duckysolut-2voc
The idea is to keep track of what permutations of numbers are possible as you go through the list. Keeping tracking of the real permutations though is impossibl
DuckySolutions
NORMAL
2024-12-03T01:37:26.436240+00:00
2024-12-03T01:37:26.436277+00:00
8
false
The idea is to keep track of what permutations of numbers are possible as you go through the list. Keeping tracking of the real permutations though is impossible as there are an exponential amount of possible permutations.\n\nOne thing to note though, is that for (1) or (2) to be possible, they have to appear in the li...
0
0
['Python3']
0
shortest-impossible-sequence-of-rolls
scala oneliner
scala-oneliner-by-vititov-lbkt
scala []\nobject Solution {\n import scala.util.chaining._\n def shortestSequence(rolls: Array[Int], k: Int): Int = \n rolls.iterator.foldLeft((0,Set.empty
vititov
NORMAL
2024-11-08T19:17:10.509099+00:00
2024-11-08T19:17:10.509128+00:00
0
false
```scala []\nobject Solution {\n import scala.util.chaining._\n def shortestSequence(rolls: Array[Int], k: Int): Int = \n rolls.iterator.foldLeft((0,Set.empty[Int])){case ((acc,aSet),roll) =>\n (aSet + roll).pipe{bSet =>if(bSet.size < k) (acc,bSet) else (acc+1,Set())}\n }._1+1\n}\n```
0
0
['Hash Table', 'Greedy', 'Scala']
0
shortest-impossible-sequence-of-rolls
Greedy find full segments
greedy-find-full-segments-by-fredzqm-ei8p
Code\njava []\nclass Solution {\n public int shortestSequence(int[] rolls, int k) {\n Set<Integer> s = new HashSet<>();\n int numSeg = 0;\n
fredzqm
NORMAL
2024-11-03T18:53:45.902260+00:00
2024-11-03T18:53:45.902287+00:00
2
false
# Code\n```java []\nclass Solution {\n public int shortestSequence(int[] rolls, int k) {\n Set<Integer> s = new HashSet<>();\n int numSeg = 0;\n for (int i = 0; i < rolls.length; i++) {\n s.add(rolls[i]);\n if (s.size() == k) {\n numSeg++;\n s ...
0
0
['Java']
0
shortest-impossible-sequence-of-rolls
Python (Simple Maths)
python-simple-maths-by-rnotappl-ryem
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
rnotappl
NORMAL
2024-10-25T06:58:40.768529+00:00
2024-10-25T06:58:40.768559+00:00
4
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ --...
0
0
['Python3']
0
shortest-impossible-sequence-of-rolls
Simple And Fast Solution
simple-and-fast-solution-by-nishk2-rl5q
Code\nphp []\nclass Solution {\n\tfunction shortestSequence($rolls, $k){\n\t\t$len = 1;\n\t\t$met = [];\n\n\t\tforeach ($rolls as $roll) {\n\t\t\tif (!isset($me
nishk2
NORMAL
2024-10-08T10:08:19.839617+00:00
2024-10-08T10:08:19.839675+00:00
0
false
# Code\n```php []\nclass Solution {\n\tfunction shortestSequence($rolls, $k){\n\t\t$len = 1;\n\t\t$met = [];\n\n\t\tforeach ($rolls as $roll) {\n\t\t\tif (!isset($met[$roll])) {\n\t\t\t\t$met[$roll] = 0;\n\t\t\t}\n\n\t\t\tif (count($met) === $k) {\n\t\t\t\t$len++;\n\t\t\t\t$met = [];\n\t\t\t}\n\t\t}\n\n\t\treturn $len;...
0
0
['PHP']
0
shortest-impossible-sequence-of-rolls
[Accepted] Swift
accepted-swift-by-vasilisiniak-msvk
\nclass Solution {\n func shortestSequence(_ rolls: [Int], _ k: Int) -> Int {\n \n var s = Set<Int>()\n var tgt = 1\n\n for r in
vasilisiniak
NORMAL
2024-09-20T11:25:56.809777+00:00
2024-09-20T11:25:56.809816+00:00
0
false
```\nclass Solution {\n func shortestSequence(_ rolls: [Int], _ k: Int) -> Int {\n \n var s = Set<Int>()\n var tgt = 1\n\n for r in rolls {\n s.insert(r)\n \n if s.count == k {\n s.removeAll()\n tgt += 1\n }\n ...
0
0
['Swift']
0
shortest-impossible-sequence-of-rolls
Python || Simple solution || Sets
python-simple-solution-sets-by-vilaparth-osrq
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
vilaparthibhaskar
NORMAL
2024-08-27T22:32:46.634582+00:00
2024-08-27T22:32:46.634613+00:00
14
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\no(n)\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n...
0
0
['Array', 'Greedy', 'Python3']
0
shortest-impossible-sequence-of-rolls
C++
c-by-user5976fh-pvoc
\nclass Solution {\npublic:\n int shortestSequence(vector<int>& r, int k) {\n int ans = 1;\n unordered_set<int> s;\n for (auto& n : r){\
user5976fh
NORMAL
2024-08-14T15:52:52.624528+00:00
2024-08-14T15:52:52.624561+00:00
0
false
```\nclass Solution {\npublic:\n int shortestSequence(vector<int>& r, int k) {\n int ans = 1;\n unordered_set<int> s;\n for (auto& n : r){\n s.insert(n);\n if (s.size() == k)\n ++ans, s = {};\n }\n return ans;\n }\n};\n```
0
0
[]
0
shortest-impossible-sequence-of-rolls
Solution with Javascript
solution-with-javascript-by-manhhungit37-93nj
Code\n\n/**\n * @param {number[]} rolls\n * @param {number} k\n * @return {number}\n */\nvar shortestSequence = function(rolls, k) {\n const set = new Set();
manhhungit37
NORMAL
2024-08-12T07:40:18.586115+00:00
2024-08-12T07:40:18.586151+00:00
0
false
# Code\n```\n/**\n * @param {number[]} rolls\n * @param {number} k\n * @return {number}\n */\nvar shortestSequence = function(rolls, k) {\n const set = new Set();\n let count = 1;\n for (let roll of rolls) {\n set.add(roll);\n if (set.size === k) {\n set.clear();\n count++;\...
0
0
['JavaScript']
0
shortest-impossible-sequence-of-rolls
Python || Easy Greedy
python-easy-greedy-by-subscriber6436-v85r
Intuition\nWe\'d like to make such sequence of dice\'s rolls in a way, that it doesn\'t exist in a list of rolls. So, how to do this? If you have, as an example
subscriber6436
NORMAL
2024-08-06T15:25:45.611714+00:00
2024-08-06T15:26:57.038273+00:00
10
false
# Intuition\nWe\'d like to make such sequence of dice\'s rolls in a way, that it **doesn\'t** exist in a list of `rolls`. So, how to do this? If you have, as an example, `k=3` and `rolls=[1,2,3]`, how you can extract such a sequence?\nWell, if make all the combinations, you\'ll find, that **it\'s impossible** to make `...
0
0
['Greedy', 'Python3']
0
shortest-impossible-sequence-of-rolls
to take a track of how many set possible such that it give complete k elemant take each
to-take-a-track-of-how-many-set-possible-g9r4
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \nfrom it and then af
amit_shinde
NORMAL
2024-07-31T18:03:42.882081+00:00
2024-07-31T18:03:42.882150+00:00
0
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nfrom it and then after the end we have and extra elemant that are not in the uncomplete set \n\n# Complexity\n- Time complexity:\n<!-- Add your time com...
0
0
['C++']
0
shortest-impossible-sequence-of-rolls
C++ || Easy To Understand
c-easy-to-understand-by-sanskarkumar028-5jgo
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
sanskarkumar028
NORMAL
2024-07-30T10:17:20.307124+00:00
2024-07-30T10:18:04.763448+00:00
0
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:\nO(N * K)\n- Space complexity:\nO(K)\n# Code\n```\nclass Solution {\npublic:\n bool check(unordered_map<int, int>& mp, int k)\n ...
0
0
['Array', 'Hash Table', 'Greedy', 'C++']
0
shortest-impossible-sequence-of-rolls
Easy Java solution || 1D DP
easy-java-solution-1d-dp-by-mnnit1prakha-ye7j
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
mnnit_prakharg
NORMAL
2024-07-15T14:28:51.630412+00:00
2024-07-15T14:28:51.630449+00:00
0
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)$$ --...
0
0
['Java']
0
shortest-impossible-sequence-of-rolls
Python (Simple Maths)
python-simple-maths-by-rnotappl-2wve
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
rnotappl
NORMAL
2024-07-13T07:26:25.645207+00:00
2024-07-13T07:26:25.645247+00:00
0
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)$$ --...
0
0
['Python3']
0
shortest-impossible-sequence-of-rolls
Simple python code using set
simple-python-code-using-set-by-thomanan-8mn9
\n\n# Complexity\n- Time complexity: O(n)\n\n\n- Space complexity: O(k)\n\n# Code\n\nclass Solution:\n def shortestSequence(self, rolls: List[int], k: int) -
thomanani
NORMAL
2024-07-05T05:48:22.089300+00:00
2024-07-05T05:49:56.465131+00:00
16
false
\n\n# Complexity\n- Time complexity: $$O(n)$$\n\n\n- Space complexity: $$O(k)$$\n\n# Code\n```\nclass Solution:\n def shortestSequence(self, rolls: List[int], k: int) -> int:\n s = set()\n curr = 1\n for i in range(len(rolls)-1,-1,-1):\n s.add(rolls[i])\n if len(s) == k:\n ...
0
0
['Python3']
0
shortest-impossible-sequence-of-rolls
Very Simple Solution || Easy to understand || Explained
very-simple-solution-easy-to-understand-1ibhe
Complexity\n- Time complexity: O(n) \n\n- Space complexity: O(k) \n\n# Code\n\nclass Solution {\npublic:\n int shortestSequence(vector<int>& rolls, int k) {\
coder_rastogi_21
NORMAL
2024-06-18T05:32:54.106052+00:00
2024-06-18T05:32:54.106089+00:00
1
false
# Complexity\n- Time complexity: $$O(n)$$ \n\n- Space complexity: $$O(k)$$ \n\n# Code\n```\nclass Solution {\npublic:\n int shortestSequence(vector<int>& rolls, int k) {\n int ans = 0;\n unordered_set<int> seen;\n\n for(auto it : rolls) {\n seen.insert(it);\n if(seen.size()...
0
0
['Greedy', 'C++']
0
shortest-impossible-sequence-of-rolls
Shortest PHP solution
shortest-php-solution-by-wischerdson-zt5c
\nclass Solution\n{\n\t/**\n\t * @param int[] $rolls\n\t * @param int $k\n\t * @return int\n\t */\n\tpublic function shortestSequence($rolls, $k)\n\t{\n\t\t$len
wischerdson
NORMAL
2024-06-11T19:27:29.175292+00:00
2024-06-11T19:27:29.175326+00:00
1
false
```\nclass Solution\n{\n\t/**\n\t * @param int[] $rolls\n\t * @param int $k\n\t * @return int\n\t */\n\tpublic function shortestSequence($rolls, $k)\n\t{\n\t\t$len = 1;\n\t\t$met = [];\n\n\t\tforeach ($rolls as $roll) {\n\t\t\tif (!isset($met[$roll])) {\n\t\t\t\t$met[$roll] = 0;\n\t\t\t}\n\n\t\t\tif (count($met) === $k...
0
0
['PHP']
0
shortest-impossible-sequence-of-rolls
WebCanape [AMZ]
webcanape-amz-by-eb2hr8vpgm-exi9
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
eB2HR8vpgM
NORMAL
2024-06-11T16:14:29.132457+00:00
2024-06-11T16:14:29.132499+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:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ --...
0
0
['Python3']
0
shortest-impossible-sequence-of-rolls
WebCanape [AMZ Solution]
webcanape-amz-solution-by-eb2hr8vpgm-mdw7
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
eB2HR8vpgM
NORMAL
2024-06-11T16:00:15.246444+00:00
2024-06-11T16:01:57.622820+00:00
1
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)$$ --...
0
0
['Python3']
0
shortest-impossible-sequence-of-rolls
simple char line soln hai padhna hai to padho
simple-char-line-soln-hai-padhna-hai-to-38mit
the idea is simple check weather all k\'s from 1 to k have occurred in a segment or not and just count how many such segments and return cnt+1\n\nreason is our
Priyanshu_gupta_9620
NORMAL
2024-05-31T20:16:54.663535+00:00
2024-05-31T20:16:54.663561+00:00
4
false
the idea is simple check weather all k\'s from 1 to k have occurred in a segment or not and just count how many such segments and return cnt+1\n\nreason is our greedy soln is when we pick the first first occurence of last element from 1-k \n\neg. [1,2,2,1,3,2,2,3,1,2,3] k=3\n\nnow our greedy ans which will minimize our...
0
0
['Greedy', 'Ordered Map', 'C++']
0
shortest-impossible-sequence-of-rolls
Simple Proof || 100% Beats O(n) || Combination logic || Mathematical Proof
simple-proof-100-beats-on-combination-lo-coq1
Simple Understanding Read Point 2\n1. Iterate the array from left to right\n# if previosly n size sequence possible and currently we have k unique elements next
shubham6762
NORMAL
2024-05-23T10:46:47.102286+00:00
2024-05-23T10:46:47.102315+00:00
3
false
# Simple Understanding Read Point 2\n1. Iterate the array from left to right\n# **if previosly n size sequence possible and currently we have `k` unique elements next to n sequences then `n + 1` combinations are possible.**\n3. So Just find out number of `k` unique sequences in array\n\n# Code\n```\nclass Solution {\np...
0
0
['Math', 'Simulation', 'Combinatorics', 'Ordered Set', 'C++']
0
shortest-impossible-sequence-of-rolls
simple 7 line
simple-7-line-by-yoongyeom-ube4
Code\n\nclass Solution:\n def shortestSequence(self, rolls: List[int], k: int) -> int:\n cnt = 1\n seen = set()\n for i in range(len(rol
YoonGyeom
NORMAL
2024-05-02T03:15:27.079706+00:00
2024-05-02T03:15:27.079744+00:00
9
false
# Code\n```\nclass Solution:\n def shortestSequence(self, rolls: List[int], k: int) -> int:\n cnt = 1\n seen = set()\n for i in range(len(rolls)):\n seen.add(rolls[i])\n if len(seen) == k:\n seen = set()\n cnt += 1\n return cnt\n```
0
0
['Python3']
0
shortest-impossible-sequence-of-rolls
complexity 0(n) +simple observation
complexity-0n-simple-observation-by-asad-sb20
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \napproach is very simple
asadali0786
NORMAL
2024-04-15T06:29:34.731428+00:00
2024-04-15T06:29:34.731456+00:00
0
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\napproach is very simple you have to just think what is the smallest sequence you need to create all possible combination of N elments in you sequence ,lets take an exa...
0
0
['C++']
0
shortest-impossible-sequence-of-rolls
C++ || beats 100%
c-beats-100-by-adnan_alkam-uhc4
\n# Code\n\nclass Solution {\npublic:\n int shortestSequence(vector<int>& rolls, int k) {\n ios_base::sync_with_stdio(false);\n\t\tcin.tie(NULL);\n\t\
Adnan_Alkam
NORMAL
2024-03-26T02:34:31.022863+00:00
2024-03-26T02:34:31.022942+00:00
3
false
\n# Code\n```\nclass Solution {\npublic:\n int shortestSequence(vector<int>& rolls, int k) {\n ios_base::sync_with_stdio(false);\n\t\tcin.tie(NULL);\n\t\tcout.tie(NULL);\n\n int n = rolls.size(), ans = 1;\n vector<bool> visited(k, false);\n int k2 = 0;\n for(int i = 0; i < n; i++){...
0
0
['Hash Table', 'C++']
0
shortest-impossible-sequence-of-rolls
Beats 83% || Easy C++ Solution
beats-83-easy-c-solution-by-krishiiitp-4kty
Code\n\nclass Solution {\npublic:\n int shortestSequence(vector<int>& rolls, int k) {\n int n=rolls.size(),ans=0;\n unordered_map<int,int> mm;\
krishiiitp
NORMAL
2024-01-29T11:14:08.803999+00:00
2024-01-29T11:14:08.804019+00:00
2
false
# Code\n```\nclass Solution {\npublic:\n int shortestSequence(vector<int>& rolls, int k) {\n int n=rolls.size(),ans=0;\n unordered_map<int,int> mm;\n for(int i=0;i<n;i++){\n mm[rolls[i]]++;\n if(mm.size()==k){\n ans++;\n mm.clear();\n ...
0
0
['C++']
0
shortest-impossible-sequence-of-rolls
Linear Time Solution in python
linear-time-solution-in-python-by-muthur-c89o
Intuition\nFind out the minimum index that contains all the elements for specific frequency.\n\n\n# Complexity\n- Time complexity:\nO(N)\n\n- Space complexity:\
muthuramkumar
NORMAL
2024-01-27T05:14:59.380885+00:00
2024-01-27T05:14:59.380916+00:00
11
false
# Intuition\nFind out the minimum index that contains all the elements for specific frequency.\n\n\n# Complexity\n- Time complexity:\nO(N)\n\n- Space complexity:\nO(N)\n\n# Code\n```\nclass Solution:\n def shortestSequence(self, rolls: List[int], k: int) -> int:\n n, i = 0, 0\n visited = set()\n ...
0
0
['Python3']
0
shortest-impossible-sequence-of-rolls
Efficient JS solution - Counting + Greedy (Beat 100% time and 91% memory)
efficient-js-solution-counting-greedy-be-i75v
\n\nPro tip: Love \u8C22\u8C22 \uD83D\uDC9C\nI saw you guys using Set.clear or filling the counting list. Why do you need that when we can do it more efficientl
CuteTN
NORMAL
2024-01-23T17:32:20.746778+00:00
2024-01-23T17:32:20.746818+00:00
2
false
![image.png](https://assets.leetcode.com/users/images/3f31f459-25f7-4743-8812-12e5c5582baf_1706030872.2244008.png)\n\nPro tip: *Love \u8C22\u8C22* \uD83D\uDC9C\nI saw you guys using Set.clear or filling the counting list. Why do you need that when we can do it more efficiently with just parities! By switching a parity ...
0
0
['Greedy', 'Counting', 'JavaScript']
0
shortest-impossible-sequence-of-rolls
ruby 1-liner
ruby-1-liner-by-_-k-388i
\ndef shortest_sequence(rolls, k, s=Set[]) =\n\n rolls.count{ s.clear if (s<<_1).size==k } + 1\n
_-k-
NORMAL
2024-01-15T17:09:17.922120+00:00
2024-01-15T17:09:17.922161+00:00
6
false
```\ndef shortest_sequence(rolls, k, s=Set[]) =\n\n rolls.count{ s.clear if (s<<_1).size==k } + 1\n```
0
0
['Ruby']
0
shortest-impossible-sequence-of-rolls
Easy Solution in Javascript
easy-solution-in-javascript-by-chetannad-6ylv
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
chetannada
NORMAL
2023-12-28T18:12:20.385430+00:00
2023-12-28T18:12:20.385454+00:00
0
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)$$ --...
0
0
['JavaScript']
0
shortest-impossible-sequence-of-rolls
Python Hard
python-hard-by-lucasschnee-vhzh
\nclass Solution:\n def shortestSequence(self, rolls: List[int], k: int) -> int:\n \'\'\'\n initial thought: sliding window\n\n Note tha
lucasschnee
NORMAL
2023-11-20T21:23:26.537717+00:00
2023-11-20T21:23:26.537739+00:00
5
false
```\nclass Solution:\n def shortestSequence(self, rolls: List[int], k: int) -> int:\n \'\'\'\n initial thought: sliding window\n\n Note that the sequence taken does not have to be consecutive as long as it is in order. \n\n contiguous\n\n meaning for every \n\n\n\n 3\n\n...
0
0
['Python3']
0
goat-latin
[C++/Java/Python] Straight Forward Solution
cjavapython-straight-forward-solution-by-xklq
Explanation\n1. Build a vowel set.(optional)\n2. Split \'S\' to words.\n3. For each word, check if it starts with a vowel. (O(1) complexity with set).\n4. If it
lee215
NORMAL
2018-04-29T06:45:49.651714+00:00
2020-08-19T15:49:05.023667+00:00
18,802
false
# Explanation\n1. Build a vowel set.(optional)\n2. Split \'S\' to words.\n3. For each word, check if it starts with a vowel. (O(1) complexity with set).\n4. If it does, keep going. If it does not, rotate the first letter to the end.\n5. Add it to result string.\n<br>\n\n**C++:**\n```cpp\n string toGoatLatin(string S...
125
6
[]
37
goat-latin
Short C++ solution using i/o stringstream
short-c-solution-using-io-stringstream-b-0eh2
\nstring toGoatLatin(string S) {\n stringstream iss(S), oss;\n string vowels("aeiouAEIOU"), word, a;\n while (iss >> word) {\n a.push_back(\'a\'
mzchen
NORMAL
2018-04-29T03:29:57.338152+00:00
2018-09-26T15:51:43.337918+00:00
6,405
false
```\nstring toGoatLatin(string S) {\n stringstream iss(S), oss;\n string vowels("aeiouAEIOU"), word, a;\n while (iss >> word) {\n a.push_back(\'a\');\n if (vowels.find_first_of(word[0]) != string::npos) // begin with a vowel\n oss << \' \' << word << "ma" << a;\n else // begin w...
68
1
[]
17
goat-latin
Java 2 ms solution with time and space complexity explanation
java-2-ms-solution-with-time-and-space-c-fgu5
java\n/**\n * Time Complexity: O(3*L + N^2) = O(Split + Substring + Adding word to sb +\n * Adding suffix to sb)\n *\n * Space Complexity: O(L + N^2 + N) = O(In
wtc2021
NORMAL
2018-05-03T07:39:09.029005+00:00
2019-09-09T07:38:42.334440+00:00
6,230
false
```java\n/**\n * Time Complexity: O(3*L + N^2) = O(Split + Substring + Adding word to sb +\n * Adding suffix to sb)\n *\n * Space Complexity: O(L + N^2 + N) = O(Input string + Suffix for all words +\n * Suffix sb)\n *\n * L = Length of the input string. N = Number of words in the input string.\n */\nclass Solution {\n ...
35
2
[]
7
goat-latin
[Python] Just do what is asked, explained
python-just-do-what-is-asked-explained-b-3khs
This is easy prolem, where you need just to do what is asked, without really thinking.\n\n1. Split our sentence into words, using .split(). If it is not allowed
dbabichev
NORMAL
2020-08-19T07:34:10.741782+00:00
2020-08-19T12:02:06.056621+00:00
2,297
false
This is easy prolem, where you need just to do what is asked, without really thinking.\n\n1. Split our sentence into words, using `.split()`. If it is not allowed we can just traverse it and find spaces.\n2. For every word check if it starts with vowel, if it is, add `ma` and `i+1` letters `a` to the end. It is `i+1`, ...
32
5
[]
3
goat-latin
[Python] (Very Easy to understand solution)
python-very-easy-to-understand-solution-hsfxx
\nclass Solution:\n def toGoatLatin(self, S: str) -> str:\n temp = []\n ans = " " # Here space must be present. (So, after joining the words,
not_a_cp_coder
NORMAL
2020-08-19T07:45:52.603609+00:00
2020-08-19T07:46:16.250234+00:00
2,496
false
```\nclass Solution:\n def toGoatLatin(self, S: str) -> str:\n temp = []\n ans = " " # Here space must be present. (So, after joining the words, they wil be separated by space)\n i = 1\n vowel = [\'a\', \'e\', \'i\', \'o\', \'u\', \'A\', \'E\', \'I\', \'O\', \'U\']\n for word in S...
18
1
['Python', 'Python3']
4
goat-latin
C++, easy to understand, just as we think!
c-easy-to-understand-just-as-we-think-by-x23t
\nclass Solution {\nprivate:\n bool isVowel(char c) {\n c = tolower(c);\n return (c == \'a\' || c == \'e\' || c == \'i\' || c == \'o\' || c ==
vasant17
NORMAL
2018-06-17T02:58:07.752706+00:00
2018-10-25T14:12:29.657310+00:00
2,101
false
```\nclass Solution {\nprivate:\n bool isVowel(char c) {\n c = tolower(c);\n return (c == \'a\' || c == \'e\' || c == \'i\' || c == \'o\' || c == \'u\');\n }\n \npublic:\n string toGoatLatin(string S) {\n string result;\n string append = "maa", w;\n istringstream line(S);\...
14
0
[]
3
goat-latin
Java 1ms 100% - Clean & Efficient O(n) Solution (Faster Solution)
java-1ms-100-clean-efficient-on-solution-7jl0
Hit the UPVOTE! Thankyou <3\n\nclass Solution {\n public String toGoatLatin(String sentence) {\n StringBuilder sb = new StringBuilder();\n Stri
talhashaikh1998
NORMAL
2021-09-17T20:06:15.142701+00:00
2021-09-17T20:06:15.142738+00:00
1,517
false
**Hit the UPVOTE! Thankyou <3**\n```\nclass Solution {\n public String toGoatLatin(String sentence) {\n StringBuilder sb = new StringBuilder();\n String[] words = sentence.split(" ");\n int r = 1;\n for(String word : words){\n char ch = word.charAt(0);\n if(ch == \'a...
12
1
['Java']
4
goat-latin
C++ Clean&Clear Solution 100% faster using istringstream with explanations
c-cleanclear-solution-100-faster-using-i-yq7n
\nclass Solution {\npublic:\n string toGoatLatin(string S) \n {\n // result\n string goatLatin = "";\n \n static const string
debbiealter
NORMAL
2020-08-19T08:48:37.814861+00:00
2020-08-19T08:58:05.929284+00:00
1,340
false
```\nclass Solution {\npublic:\n string toGoatLatin(string S) \n {\n // result\n string goatLatin = "";\n \n static const string VOWELS = "aAeEiIoOuU";\n \n // to keep count of how many "a"s to add\n size_t count = 1;\n \n\t\t// for spliting sentence to word...
10
1
['C++']
1
goat-latin
JavaScript two lines
javascript-two-lines-by-shengdade-bu6l
javascript\n/**\n * @param {string} S\n * @return {string}\n */\nvar toGoatLatin = function(S) {\n const vowels = new Set([\'a\', \'e\', \'i\', \'o\', \'u\', \
shengdade
NORMAL
2020-02-15T15:11:51.151663+00:00
2020-02-15T15:11:51.151694+00:00
631
false
```javascript\n/**\n * @param {string} S\n * @return {string}\n */\nvar toGoatLatin = function(S) {\n const vowels = new Set([\'a\', \'e\', \'i\', \'o\', \'u\', \'A\', \'E\', \'I\', \'O\', \'U\']);\n return S.split(\' \')\n .map((w, i) =>\n vowels.has(w[0])\n ? w + \'ma\' + \'a\'.repeat(i + 1)\n ...
9
2
['JavaScript']
1
goat-latin
C++ Soolution, 0ms, 9MB(less than 100%)
c-soolution-0ms-9mbless-than-100-by-pooj-u6sr
Runtime: 0 ms, faster than 100.00% of C++ online submissions for Goat Latin.\nMemory Usage: 9 MB, less than 100.00% of C++ online submissions for Goat Latin.\n\
pooja0406
NORMAL
2019-09-10T10:32:13.139131+00:00
2019-09-10T10:32:13.139182+00:00
699
false
Runtime: 0 ms, faster than 100.00% of C++ online submissions for Goat Latin.\nMemory Usage: 9 MB, less than 100.00% of C++ online submissions for Goat Latin.\n\n```\nstring toGoatLatin(string S) {\n \n int front = 0;\n int count = 1;\n int n = S.size();\n string res;\n \n ...
9
2
['C']
2
goat-latin
[C++/Python] Challenge me for shorter solution (1Line python & 3Line C++)
cpython-challenge-me-for-shorter-solutio-w17p
Idea:\nFuzzy grammar between string and set in python make coding simple.\nC++ does not have such freedom as Python in this case.\n\nSolution 1:\n\nclass Soluti
codedayday
NORMAL
2020-08-19T20:23:04.911626+00:00
2022-10-31T16:51:14.898975+00:00
863
false
Idea:\nFuzzy grammar between string and set in python make coding simple.\nC++ does not have such freedom as Python in this case.\n\nSolution 1:\n```\nclass Solution:\n def toGoatLatin(self, S: str) -> str:\n vowel=\'aeiouAEIOU\'\n sList=S.strip().split()\n result = \'\'\n for i, w in enu...
7
0
['C', 'Python']
4
goat-latin
C++ 0ms , faster than 100% solutions
c-0ms-faster-than-100-solutions-by-paran-evu3
class Solution {\npublic:\n string toGoatLatin(string s) {\n \n int n = s.size();\n string ans = "";\n int x =1; // last m string m \
paranoid-619
NORMAL
2021-12-13T09:40:56.178308+00:00
2021-12-13T09:40:56.178337+00:00
860
false
class Solution {\npublic:\n string toGoatLatin(string s) {\n \n int n = s.size();\n string ans = "";\n int x =1; // last m string m \'a\' add krne k liye ( index 1 pr 1 \'a\' , index 2 pr 2 \'a\' and sp on)//\n for(int i = 0;i<s.size();i++){\n int j =i;\n if(s[i]...
6
0
['String', 'C', 'C++']
3
goat-latin
concise python solution
concise-python-solution-by-yuzhoul-6q7f
```\nclass Solution:\n def toGoatLatin(self, S):\n """\n :type S: str\n :rtype: str\n """\n words = S.split()\n vow
yuzhoul
NORMAL
2018-05-01T20:51:29.892909+00:00
2018-05-01T20:51:29.892909+00:00
1,064
false
```\nclass Solution:\n def toGoatLatin(self, S):\n """\n :type S: str\n :rtype: str\n """\n words = S.split()\n vowels = \'AEIOUaeiou\'\n def transform(stuff):\n idx, word = stuff\n if word[0] in vowels:\n word += \'ma\'\n ...
6
1
[]
0
goat-latin
Easy Java solution, 13 ms
easy-java-solution-13-ms-by-lifeisnotcod-czwi
public String toGoatLatin(String S) {\n \n List list=new ArrayList(Arrays.asList(\'a\',\'e\',\'i\',\'o\',\'u\',\'A\',\'E\',\'I\',\'O\',\'U\'));\n
LifeIsNotCoding
NORMAL
2018-04-30T01:01:03.517689+00:00
2018-04-30T01:01:03.517689+00:00
1,151
false
public String toGoatLatin(String S) {\n \n List<Character> list=new ArrayList<Character>(Arrays.asList(\'a\',\'e\',\'i\',\'o\',\'u\',\'A\',\'E\',\'I\',\'O\',\'U\'));\n String arr[]=S.split(" ");\n String a="a",test="";\n StringBuffer sb=new StringBuffer();\n \n for(int i=...
6
0
[]
1
goat-latin
Kotlin Best Solution
kotlin-best-solution-by-progp-ijdu
\n# Code\n\nclass Solution {\nfun toGoatLatin(S: String): String {\n val a = StringBuilder("a")\n return S.split(" ").joinToString(" ") {\n if ("ae
progp
NORMAL
2023-12-10T08:02:26.047273+00:00
2023-12-10T08:02:26.047304+00:00
104
false
\n# Code\n```\nclass Solution {\nfun toGoatLatin(S: String): String {\n val a = StringBuilder("a")\n return S.split(" ").joinToString(" ") {\n if ("aeiou".contains(it[0].toLowerCase())) (it + "ma" + a).also { a.append("a") }\n else (it.substring(1) + it[0] + "ma" + a).also { a.append("a") }\n }\n...
5
0
['Kotlin']
0
goat-latin
Python // 36 ms // 2-liner & 4-liner
python-36-ms-2-liner-4-liner-by-cenkay-tn93
\nclass Solution:\n def toGoatLatin(self, S):\n s, vowels = S.split(), {"a", "e", "i", "o", "u"} \n return " ".join([(s[i][0].lower() in vowels
cenkay
NORMAL
2018-04-29T03:18:21.490753+00:00
2018-10-25T14:12:54.965105+00:00
945
false
```\nclass Solution:\n def toGoatLatin(self, S):\n s, vowels = S.split(), {"a", "e", "i", "o", "u"} \n return " ".join([(s[i][0].lower() in vowels and s[i] or s[i][1:] + s[i][0]) + "m" + "a" * (i + 2) for i in range(len(s))])\n```\n* 4 line solution for better readability:\n```\nclass Solution:\n de...
5
0
[]
3
goat-latin
[Python 3] - Simple Solution w Explanation
python-3-simple-solution-w-explanation-b-s1yc
Still fairly new to Python so open to any suggestions or improvements! \n\nclass Solution:\n def toGoatLatin(self, sentence: str) -> str:\n new = sent
IvanTsukei
NORMAL
2022-03-23T18:37:04.396400+00:00
2022-03-23T18:37:04.396482+00:00
1,297
false
Still fairly new to Python so open to any suggestions or improvements! \n```\nclass Solution:\n def toGoatLatin(self, sentence: str) -> str:\n new = sentence.split() # Breaks up the input into individual sentences\n count = 1 # Starting at 1 since we only have one "a" to begin with.\n \n ...
4
0
['Python', 'Python3']
1
goat-latin
[C++] 0 ms, Easy to understand solution
c-0-ms-easy-to-understand-solution-by-an-59td
\n string toGoatLatin(string S) \n {\n vector<char> vowel{\'a\', \'e\', \'i\', \'o\', \'u\', \'A\', \'E\', \'I\', \'O\', \'U\'};\n string res="
anjali_cs
NORMAL
2021-03-11T19:17:08.245378+00:00
2021-03-12T19:16:03.885237+00:00
305
false
```\n string toGoatLatin(string S) \n {\n vector<char> vowel{\'a\', \'e\', \'i\', \'o\', \'u\', \'A\', \'E\', \'I\', \'O\', \'U\'};\n string res="";\n stringstream s(S); //for splitting sentence to words\n string word;\n int curr=1; //keeping a counter to append \'a\'\n whil...
4
0
['C']
0
goat-latin
Python super-simple intuitive solution
python-super-simple-intuitive-solution-b-vbd4
Like it? please upvote...\n\nclass Solution:\n def toGoatLatin(self, S: str) -> str:\n count = 0\n res = []\n for word in S.split():\n
yehudisk
NORMAL
2020-08-19T07:13:20.909941+00:00
2020-08-19T07:19:52.952726+00:00
276
false
**Like it? please upvote...**\n```\nclass Solution:\n def toGoatLatin(self, S: str) -> str:\n count = 0\n res = []\n for word in S.split():\n count+=1\n if word[0].lower() in [\'a\', \'e\', \'i\', \'o\', \'u\']:\n res.append(word+"ma"+\'a\'*count)\n ...
4
0
['Python3']
0
goat-latin
cpp with 100% ms
cpp-with-100-ms-by-ahmed_433-lqg9
Code
Ahmed_433
NORMAL
2024-12-30T21:59:20.659567+00:00
2024-12-30T21:59:20.659567+00:00
254
false
# Code ```cpp [] class Solution { public: string toGoatLatin(string sentence) { deque<string>a; string ans=""; string trill=""; string s; int cnt=0; for(int i=0;i<sentence.size()+1;i++) {if(sentence[i]!=' ') { s+=sentence[i]; }else { cnt++; a.push_ba...
3
0
['C++']
2
goat-latin
Beats 100%🔥|| easy JAVA Solution✅
beats-100-easy-java-solution-by-priyansh-tl9n
Code\n\nclass Solution {\n public String toGoatLatin(String sentence) {\n String[] str=sentence.split(" ");\n StringBuilder ans=new StringBuild
priyanshu1078
NORMAL
2024-02-05T10:51:11.578079+00:00
2024-02-05T10:51:11.578154+00:00
477
false
# Code\n```\nclass Solution {\n public String toGoatLatin(String sentence) {\n String[] str=sentence.split(" ");\n StringBuilder ans=new StringBuilder();\n StringBuilder x=new StringBuilder();\n for(int i=0;i<str.length;i++){\n x.append("a");\n if(isVowel(str[i])){\n...
3
0
['Java']
0
goat-latin
NOOB CODE : EASY TO UNDERSTAND
noob-code-easy-to-understand-by-harshava-ga30
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n1. If a word begins with a vowel (a, e, i, o, u, A, E, I, O, U), append "
HARSHAVARDHAN_15
NORMAL
2023-09-30T09:17:18.162781+00:00
2023-09-30T09:17:18.162803+00:00
949
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n1. If a word begins with a vowel (a, e, i, o, u, A, E, I, O, U), append "ma" to the end of the word.\n2. If a word begins with a consonant, remove the first letter and append it to the end of the word, followed by "ma."\n3. ...
3
0
['Python3']
0
goat-latin
Java Easy Solution Beats 100% runtime & 99.21% memory
java-easy-solution-beats-100-runtime-992-7327
Intuition\nThe intuition behind this solution is to iterate through each word in the input sentence, apply the Goat Latin rules to each word, and then build the
Laziz_511
NORMAL
2023-09-07T10:03:17.504582+00:00
2023-09-07T10:03:17.504602+00:00
336
false
# Intuition\nThe intuition behind this solution is to iterate through each word in the input sentence, apply the Goat Latin rules to each word, and then build the final Goat Latin sentence by appending the modified words together.\n\n# Approach\n1. Initialize a `StringBuilder` named `goatLatin` to store the Goat Latin ...
3
0
['Java']
1
goat-latin
Use StringBuilder || JAVA || Just 1 loop
use-stringbuilder-java-just-1-loop-by-im-0qsb
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
im_obid
NORMAL
2022-11-27T16:45:05.411565+00:00
2022-11-27T16:45:05.411715+00:00
680
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
['Java']
0
goat-latin
✔️[C++]||Easy Solution
ceasy-solution-by-nikhil909-zr43
class Solution {\nprivate:\n\n\n bool isVowel(char ch){\n if(ch==\'a\'||ch==\'e\'||ch==\'i\'||ch==\'o\'||ch==\'u\'||ch==\'A\'||ch==\'E\'||ch==\'I\'||c
nikhil909
NORMAL
2022-08-29T20:36:39.587516+00:00
2022-08-29T20:36:39.587559+00:00
610
false
class Solution {\nprivate:\n\n\n bool isVowel(char ch){\n if(ch==\'a\'||ch==\'e\'||ch==\'i\'||ch==\'o\'||ch==\'u\'||ch==\'A\'||ch==\'E\'||ch==\'I\'||ch==\'O\'||ch==\'U\'){\n return true;\n }\n return false;\n }\npublic:\n\n string toGoatLatin(string sentence) {\n int len ...
3
0
['C', 'C++']
0
goat-latin
[JAVA] BEATS 100.00% MEMORY/SPEED 0ms // APRIL 2022
java-beats-10000-memoryspeed-0ms-april-2-56et
\n\tclass Solution {\n\n public String toGoatLatin(String sentence) {\n StringBuilder sb = new StringBuilder();\n String[] words = sentence.spl
darian-catalin-cucer
NORMAL
2022-04-20T06:41:59.630003+00:00
2022-04-20T06:41:59.630059+00:00
285
false
\n\tclass Solution {\n\n public String toGoatLatin(String sentence) {\n StringBuilder sb = new StringBuilder();\n String[] words = sentence.split(" ");\n int r = 1;\n for(String word : words){\n char ch = word.charAt(0);\n if(ch == \'a\' || ch == \'e\' || ch == \'i\'...
3
0
['Java']
0
goat-latin
Simple solution in Golang
simple-solution-in-golang-by-bhargavsnv1-56yn
Code\n====\n\ngo\nfunc isVowel(s string) bool {\n\tletter := strings.ToLower(string(s[0]))\n\n\tswitch letter {\n\tcase "a", "e", "i", "o", "u":\n\t\treturn tru
bhargavsnv100
NORMAL
2020-11-06T18:17:34.799082+00:00
2020-11-06T18:17:34.799138+00:00
147
false
Code\n====\n\n```go\nfunc isVowel(s string) bool {\n\tletter := strings.ToLower(string(s[0]))\n\n\tswitch letter {\n\tcase "a", "e", "i", "o", "u":\n\t\treturn true\n\t}\n\n\treturn false\n}\n\nfunc toGoatLatin(S string) string {\n\twords := strings.Split(S, " ")\n\tsolution := ""\n\n\tfor i, word := range words {\n\t\...
3
0
['Go']
0
goat-latin
golang
golang-by-zz12345-nejy
\nfunc toGoatLatin(S string) string {\n\tif len(S) == 0 {\n\t\treturn ""\n\t}\n\n\tstrs := strings.Split(S, " ")\n\tfor i := 0; i < len(strs); i++ {\n\t\tswitch
zz12345
NORMAL
2020-02-21T22:37:28.892446+00:00
2020-02-21T22:37:28.892496+00:00
75
false
```\nfunc toGoatLatin(S string) string {\n\tif len(S) == 0 {\n\t\treturn ""\n\t}\n\n\tstrs := strings.Split(S, " ")\n\tfor i := 0; i < len(strs); i++ {\n\t\tswitch s := strs[i]; s[0] {\n\t\tcase \'a\', \'e\', \'i\', \'o\', \'u\', \'A\', \'E\', \'I\', \'O\', \'U\':\n\t\t\tstrs[i] = s + "ma"\n\t\tdefault:\n\t\t\tstrs[i] ...
3
0
[]
0
goat-latin
1ms 99.95% JAVA Solution
1ms-9995-java-solution-by-imranansari-76xg
\nclass Solution {\n public String toGoatLatin(String str) {\n String[] words = str.split(" ");\n StringBuilder sb = new StringBuilder();\n
imranansari
NORMAL
2020-02-07T11:28:12.382941+00:00
2020-02-07T11:28:12.383025+00:00
450
false
```\nclass Solution {\n public String toGoatLatin(String str) {\n String[] words = str.split(" ");\n StringBuilder sb = new StringBuilder();\n int k = 1;\n for (String word : words) {\n char ch = word.charAt(0);\n if (ch == \'a\' || ch == \'e\' || ch == \'i\' || ch ...
3
0
['Java']
0
goat-latin
Accepted Python3 using a simple regular expression
accepted-python3-using-a-simple-regular-mk50l
\nimport re\n\nclass Solution:\n def toGoatLatin(self, S: str) -> str:\n s = S.split()\n out = \'\'\n for i, w in enumerate(s):\n
i-i
NORMAL
2019-12-17T16:32:05.253361+00:00
2019-12-17T16:32:05.253442+00:00
320
false
```\nimport re\n\nclass Solution:\n def toGoatLatin(self, S: str) -> str:\n s = S.split()\n out = \'\'\n for i, w in enumerate(s):\n if re.match(r\'(?i)^[aeiou]\', w):\n out += w + \'ma\' + (i + 1) * \'a\' + \' \'\n else:\n out += w[1:] + w[0] ...
3
0
['String', 'Python', 'Python3']
0
goat-latin
Solution in Python 3 (beats ~100%) (one line)
solution-in-python-3-beats-100-one-line-9zvfd
```\nclass Solution:\n def toGoatLatin(self, S: str) -> str:\n \treturn " ".join([(s if s[0].lower() in \'aeiou\' else s[1:]+s[0])+\'maa\'+\'a\'*i for i,s
junaidmansuri
NORMAL
2019-08-07T20:18:24.548110+00:00
2019-08-07T20:20:05.283064+00:00
245
false
```\nclass Solution:\n def toGoatLatin(self, S: str) -> str:\n \treturn " ".join([(s if s[0].lower() in \'aeiou\' else s[1:]+s[0])+\'maa\'+\'a\'*i for i,s in enumerate(S.split())])\n\n\n- Junaid Mansuri\n(LeetCode ID)@hotmail.com
3
1
['Python', 'Python3']
0
goat-latin
C Solution
c-solution-by-sunsfz-di27
\nchar* toGoatLatin(char* S) {\n int aCount = 1;\n int ansSize = 0;\n int ansIndex = 0;\n char* ans = malloc(0);\n char s[1] = {\' \'};\n char
sunsfz
NORMAL
2019-02-16T17:42:31.499175+00:00
2019-02-16T17:42:31.499213+00:00
378
false
```\nchar* toGoatLatin(char* S) {\n int aCount = 1;\n int ansSize = 0;\n int ansIndex = 0;\n char* ans = malloc(0);\n char s[1] = {\' \'};\n char* token;\n char vowel;\n \n token = strtok(S, s); \n while(1)\n {\n ansSize += strlen(token) + 4 + aCount;\n ans = realloc(an...
3
0
['C']
0
goat-latin
Python solution
python-solution-by-zitaowang-i397
Time complexity: O(n), space complexity: O(n), where n is the number of characters in S.\n\n\nclass Solution:\n def toGoatLatin(self, S):\n """\n
zitaowang
NORMAL
2019-01-22T08:58:22.320826+00:00
2019-01-22T08:58:22.320882+00:00
236
false
Time complexity: `O(n)`, space complexity: `O(n)`, where `n` is the number of characters in `S`.\n\n```\nclass Solution:\n def toGoatLatin(self, S):\n """\n :type S: str\n :rtype: str\n """\n vowels = {\'a\',\'e\',\'i\',\'o\',\'u\',\'A\',\'E\',\'I\',\'O\',\'U\'}\n word_list ...
3
0
[]
0
goat-latin
Javascript solution beats 100%
javascript-solution-beats-100-by-thidkya-k6bd
\nfunction goatLatin(s) {\n return s\n .split(" ")\n .map(word => {\n if (word.match(/^[aeiouAEIOU]/g)) {\n return word + "ma";\n } else
thidkyar
NORMAL
2018-12-18T20:09:38.986332+00:00
2018-12-18T20:09:38.986408+00:00
351
false
```\nfunction goatLatin(s) {\n return s\n .split(" ")\n .map(word => {\n if (word.match(/^[aeiouAEIOU]/g)) {\n return word + "ma";\n } else {\n return word.slice(1) + word.charAt(0) + "ma";\n }\n })\n .map((word, i) => {\n return word + "a".repeat(i + 1);\n }).join(\' \...
3
0
[]
2
goat-latin
Easy solution, readable, using StringBuilder and a foreach.
easy-solution-readable-using-stringbuild-hjby
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
jandujo
NORMAL
2024-11-13T03:41:02.612570+00:00
2024-11-13T03:41:02.612653+00:00
44
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n$$O(n)$$\n\n- Space complexity:\n$$O(n)$$\n\n# Code\n```csharp []\npublic class Solution {\n public string ToGoatLatin(string se...
2
0
['C#']
0
goat-latin
Brute Force Approach || Python3
brute-force-approach-python3-by-lavanya_-kl82
Intuition\nWhen transforming the input sentence into "Goat Latin," the process primarily revolves around manipulating individual words in the sentence based on
lavanya_immaneni
NORMAL
2024-10-19T04:48:53.854212+00:00
2024-10-19T04:48:53.854236+00:00
471
false
# Intuition\nWhen transforming the input sentence into "Goat Latin," the process primarily revolves around manipulating individual words in the sentence based on whether they start with a vowel or consonant. Additionally, a suffix ("ma") and increasing "a"s are added to each word.\n\n# Approach\n1. Split the sentence: ...
2
0
['Python3']
0
goat-latin
Very simple solution.
very-simple-solution-by-srh_abhay-w4kk
Code\npython3 []\nclass Solution:\n def toGoatLatin(self, sentence: str) -> str:\n words = sentence.split()\n vowels = \'aeiouAEIOU\'\n
srh_abhay
NORMAL
2024-10-12T14:22:11.691689+00:00
2024-10-12T14:22:11.691721+00:00
450
false
# Code\n```python3 []\nclass Solution:\n def toGoatLatin(self, sentence: str) -> str:\n words = sentence.split()\n vowels = \'aeiouAEIOU\'\n goat_latin_words = []\n\n for index, word in enumerate(words):\n if word[0] in vowels:\n goat_word = word + "ma"\n ...
2
0
['Python3']
0
goat-latin
Java solution || beats 100% || with explanation
java-solution-beats-100-with-explanation-ahw3
Intuition\nThe problem seems to require transforming a sentence into "Goat Latin" according to some rules, such as appending "ma" to each word and adding a suff
vidojevica
NORMAL
2024-05-14T23:07:55.897232+00:00
2024-05-14T23:07:55.897263+00:00
233
false
# Intuition\nThe problem seems to require transforming a sentence into "Goat Latin" according to some rules, such as appending "ma" to each word and adding a suffix based on the word\'s position.\n\n# Approach\n1. Split the input sentence into words.\n2. Iterate through each word.\n3. Check if the word starts with a...
2
0
['String', 'Java']
1
goat-latin
C++ Simple Solution
c-simple-solution-by-ayushsachan123-dq2k
Complexity\n- Time complexity:\no(n)\n\n- Space complexity:\no(n) \nn -> size of the string\n\n# Code\n\nclass Solution {\npublic:\n\nstring solve(string &s){\n
ayushsachan123
NORMAL
2023-12-29T17:38:21.239967+00:00
2023-12-29T17:38:21.239999+00:00
357
false
# Complexity\n- Time complexity:\no(n)\n\n- Space complexity:\no(n) \nn -> size of the string\n\n# Code\n```\nclass Solution {\npublic:\n\nstring solve(string &s){\n int n = s.size();\n string ans = "";\n int k=0;\n for(int i=0;i<n;i++){\n int j = i;\n k++;\n string temp = "";\n string ...
2
0
['String', 'C++']
0
goat-latin
Python3 code
python3-code-by-manasaanand1711-34fg
Intuition\n1.Split the input sentence into individual words using the .split() method, and store them in a list called w.\n2.Initialize empty lists l and v to s
manasaanand1711
NORMAL
2023-10-02T15:23:28.278410+00:00
2023-10-02T15:23:28.278436+00:00
265
false
# Intuition\n1.Split the input sentence into individual words using the .split() method, and store them in a list called w.\n2.Initialize empty lists l and v to store the modified words and the final modified words, respectively.\n3.Iterate over each word i in the list w.\n4.Check if the first letter of the word i is a...
2
0
['Python3']
1
goat-latin
easy
easy-by-ratelime-gt8u
\n\nclass Solution:\n def toGoatLatin(self, sentence: str) -> str:\n k = 0\n p = ""\n for x in sentence.split(" "):\n if x[0]
RateLime
NORMAL
2023-08-11T13:45:07.907000+00:00
2023-08-11T13:45:07.907026+00:00
281
false
\n```\nclass Solution:\n def toGoatLatin(self, sentence: str) -> str:\n k = 0\n p = ""\n for x in sentence.split(" "):\n if x[0] not in ("aeiouAEIOU"): \n x = x[1:]+x[0]\n p+=x+"maa"+"a" * k\n k += 1\n if k == len(sentence.split(" ")):\n...
2
0
['Python3']
1
goat-latin
Goat Latin Solution in C++
goat-latin-solution-in-c-by-the_kunal_si-lnyx
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time
The_Kunal_Singh
NORMAL
2023-05-31T05:08:13.781130+00:00
2023-05-31T05:08:13.781169+00:00
100
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\nO(n*m)\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n...
2
0
['C++']
0
goat-latin
Solution
solution-by-deleted_user-oybo
C++ []\nclass Solution {\npublic:\n string toGoatLatin(string s) {\n string res;\n int count=0;\n for(int i=0; i<s.length(); i++){\n
deleted_user
NORMAL
2023-05-03T12:34:02.823879+00:00
2023-05-03T13:46:58.996653+00:00
1,058
false
```C++ []\nclass Solution {\npublic:\n string toGoatLatin(string s) {\n string res;\n int count=0;\n for(int i=0; i<s.length(); i++){\n string temp;\n while(s[i]!=\' \' && i<s.length()){\n temp +=s[i];\n i++;\n }\n count++...
2
0
['C++', 'Java', 'Python3']
0
goat-latin
Easy to Understand Code || Code for beginners ✅✅✅
easy-to-understand-code-code-for-beginne-4uzf
```\nstring toGoatLatin(string sentence) {\n string res,word,a="a";\n stringstream ss(sentence);\n while(ss>>word){ \n\t\t\tif(word[0]==
kunalbatham2701
NORMAL
2023-02-08T13:46:03.176373+00:00
2023-02-08T13:46:03.176401+00:00
293
false
```\nstring toGoatLatin(string sentence) {\n string res,word,a="a";\n stringstream ss(sentence);\n while(ss>>word){ \n\t\t\tif(word[0]==\'a\'||word[0]==\'e\'||word[0]==\'i\'||word[0]==\'o\'||word[0]==\'u\'||word[0]==\'A\'||word[0]==\'E\'||word[0]==\'I\'||word[0]==\'O\'||word[0]==\'U\')\n ...
2
0
['C']
0
goat-latin
Java solution without string split
java-solution-without-string-split-by-co-3ayy
```\nclass Solution {\n \n static final char[] vowels = new char[10];\n static {\n vowels[0] = \'A\';\n vowels[1] = \'E\';\n vowel
coffeeminator
NORMAL
2022-11-23T18:29:19.683489+00:00
2022-11-23T18:29:19.683584+00:00
524
false
```\nclass Solution {\n \n static final char[] vowels = new char[10];\n static {\n vowels[0] = \'A\';\n vowels[1] = \'E\';\n vowels[2] = \'I\';\n vowels[3] = \'O\';\n vowels[4] = \'U\';\n vowels[5] = \'a\';\n vowels[6] = \'e\';\n vowels[7] = \'i\';\n ...
2
0
['Binary Tree', 'Java']
0
goat-latin
Python Easy
python-easy-by-lucasschnee-jt3q
\tclass Solution:\n\t\tdef toGoatLatin(self, sentence: str) -> str:\n\t\t\tlst = sentence.split(" ")\n\n\t\t\tlst2 = []\n\n\t\t\tvowels = ["a", "e", "i", "o", "
lucasschnee
NORMAL
2022-10-25T13:31:07.186124+00:00
2022-10-25T13:31:07.186159+00:00
626
false
\tclass Solution:\n\t\tdef toGoatLatin(self, sentence: str) -> str:\n\t\t\tlst = sentence.split(" ")\n\n\t\t\tlst2 = []\n\n\t\t\tvowels = ["a", "e", "i", "o", "u"]\n\n\t\t\tfor i, word in enumerate(lst):\n\t\t\t\ttmp = word\n\n\t\t\t\tif (word[0].lower() in vowels):\n\t\t\t\t\ttmp = tmp + "ma"\n\n\t\t\t\telse: \n\t\t\t...
2
0
['Python', 'Python3']
0
goat-latin
Java Solution || Faster than 97% (Normal String Manipulation)
java-solution-faster-than-97-normal-stri-s1qe
Please upvote if you like the solution-->\n\n\nclass Solution {\n public static boolean isVowel(char c){\n return c == \'a\' || c == \'e\' || c == \'i
Ritabrata_1080
NORMAL
2022-10-23T15:57:52.739164+00:00
2022-10-23T15:57:52.739206+00:00
1,442
false
# Please upvote if you like the solution-->\n\n```\nclass Solution {\n public static boolean isVowel(char c){\n return c == \'a\' || c == \'e\' || c == \'i\' || c == \'o\' || c == \'u\';\n }\n public String toGoatLatin(String sentence) {\n List<String> list = new ArrayList<>();\n String ar...
2
0
['String', 'Java']
0
goat-latin
🐌 C# - linq
c-linq-by-user7166uf-v5bd
\npublic class Solution\n{\n public string ToGoatLatin(string sentence) \n => string.Join(\' \', sentence.Split(\' \').Select(ConvertWordToGoatLatin))
user7166Uf
NORMAL
2022-06-13T18:17:25.286780+00:00
2022-06-13T18:17:25.286817+00:00
81
false
```\npublic class Solution\n{\n public string ToGoatLatin(string sentence) \n => string.Join(\' \', sentence.Split(\' \').Select(ConvertWordToGoatLatin));\n\n private static string ConvertWordToGoatLatin(string word, int index)\n => char.ToLower(word[0]) is not (\'a\' or \'e\' or \'i\' or \'o\' or \...
2
0
['C#']
0
goat-latin
Easy CPP Solution
easy-cpp-solution-by-siddharthphalle-0p6o
```\nclass Solution {\npublic:\n string toGoatLatin(string sentence) {\n unordered_set vowels = {\'a\', \'e\', \'i\', \'o\', \'u\', \'A\', \'E\', \'I\
SiddharthPhalle
NORMAL
2022-05-30T15:22:38.819548+00:00
2022-05-30T15:22:38.819577+00:00
313
false
```\nclass Solution {\npublic:\n string toGoatLatin(string sentence) {\n unordered_set<char> vowels = {\'a\', \'e\', \'i\', \'o\', \'u\', \'A\', \'E\', \'I\', \'O\', \'U\'};\n string word = "", res= "";\n stringstream ss(sentence);\n int cnt = 1;\n while(ss>>word)\n { \n ...
2
0
['C']
0
goat-latin
Easy Python code beats 99.8%
easy-python-code-beats-998-by-vistrit-yc89
\n def toGoatLatin(self, sentence: str) -> str:\n words = sentence.split()\n vowels = "AEIOUaeiou"\n m="maa"\n l=[]\n for
vistrit
NORMAL
2021-11-03T03:33:46.557862+00:00
2021-11-03T03:33:46.557904+00:00
125
false
```\n def toGoatLatin(self, sentence: str) -> str:\n words = sentence.split()\n vowels = "AEIOUaeiou"\n m="maa"\n l=[]\n for i in words:\n if i[0] in vowels:\n l.append(i + m)\n else:\n l.append(i[1:] + i[0] + m)\n m+="...
2
0
['Python']
0
goat-latin
Time and Space Complexity of Python Solution
time-and-space-complexity-of-python-solu-kfz3
\n \n vowels = set("aeiouAEIOU")\n ma="ma"\n \n def goat_latin(word, index):\n \n end = "a"(index+1)\n
venom736
NORMAL
2021-07-24T09:00:31.756049+00:00
2021-07-24T09:06:58.601762+00:00
68
false
\n \n vowels = set("aeiouAEIOU")\n ma="ma"\n \n def goat_latin(word, index):\n \n end = "a"*(index+1)\n if word[0] not in vowels:\n \n word = word[1:] + word[0]\n \n return word + ma + end\n \n...
2
0
[]
0
goat-latin
(C++) 824. Goat Latin
c-824-goat-latin-by-qeetcode-2jtz
\n\nclass Solution {\npublic:\n string toGoatLatin(string S) {\n string ans, word, vowels = "aeiouAEIOU", suffix; \n istringstream iss(S); \n
qeetcode
NORMAL
2021-04-15T19:55:44.299431+00:00
2021-04-15T19:55:44.299475+00:00
190
false
\n```\nclass Solution {\npublic:\n string toGoatLatin(string S) {\n string ans, word, vowels = "aeiouAEIOU", suffix; \n istringstream iss(S); \n ostringstream oss; \n \n while (iss >> word) {\n suffix.push_back(\'a\'); \n if (vowels.find(word[0]) == string::np...
2
0
['C']
1
goat-latin
Simple Solution In Java
simple-solution-in-java-by-s34-k8f4
\nclass Solution {\n public String toGoatLatin(String S) {\n String[] tmp=S.split(" ");\n String res="";\n Set<Character> s=new HashSet<
s34
NORMAL
2021-02-22T01:36:43.900573+00:00
2021-02-22T01:36:43.900612+00:00
253
false
```\nclass Solution {\n public String toGoatLatin(String S) {\n String[] tmp=S.split(" ");\n String res="";\n Set<Character> s=new HashSet<>();\n s.add(\'a\');s.add(\'e\');s.add(\'i\');s.add(\'o\');s.add(\'u\');\n s.add(\'A\');s.add(\'E\');s.add(\'I\');s.add(\'O\');s.add(\'U\');\n ...
2
0
[]
0
goat-latin
Simple Python Solution
simple-python-solution-by-lokeshsk1-92r3
\nclass Solution:\n def toGoatLatin(self, S: str) -> str:\n out=\'\'\n l=S.split()\n for i in range(len(l)):\n if l[i][0] in
lokeshsk1
NORMAL
2020-11-24T18:26:05.502944+00:00
2020-11-24T18:26:33.632849+00:00
193
false
```\nclass Solution:\n def toGoatLatin(self, S: str) -> str:\n out=\'\'\n l=S.split()\n for i in range(len(l)):\n if l[i][0] in \'aeiouAEIOU\':\n out+=l[i]+\'m\'+\'a\'*(i+2)+\' \'\n else:\n out+=l[i][1:]+l[i][0]+\'m\'+\'a\'*(i+2)+\' \'\n ...
2
0
['Python', 'Python3']
0
goat-latin
Clean JavaScript Solution
clean-javascript-solution-by-shimphillip-pyv3
\n// time O(n^2) time O(1)\nvar toGoatLatin = function(S) {\n const vowels = \'aeiouAEIOU\'\n const arr = S.split(\' \')\n \n for(let i=0; i<arr.len
shimphillip
NORMAL
2020-11-09T03:03:19.505683+00:00
2020-11-09T03:03:19.505732+00:00
418
false
```\n// time O(n^2) time O(1)\nvar toGoatLatin = function(S) {\n const vowels = \'aeiouAEIOU\'\n const arr = S.split(\' \')\n \n for(let i=0; i<arr.length; i++) {\n let word = arr[i]\n const firstChar = word[0]\n\n if(!vowels.includes(firstChar)) {\n word = word.slice(1) + fi...
2
0
['JavaScript']
1
goat-latin
[Kotlin] 2 lines of code, the power of FP
kotlin-2-lines-of-code-the-power-of-fp-b-4asx
\nfun toGoatLatin(S: String): String {\n val a = StringBuilder("a")\n return S.split(" ").joinToString(" ") {\n if ("aeiou".contains(it[0].toLowerC
nurbekinho
NORMAL
2020-08-20T12:35:11.888189+00:00
2020-08-20T12:35:11.888236+00:00
86
false
```\nfun toGoatLatin(S: String): String {\n val a = StringBuilder("a")\n return S.split(" ").joinToString(" ") {\n if ("aeiou".contains(it[0].toLowerCase())) (it + "ma" + a).also { a.append("a") }\n else (it.substring(1) + it[0] + "ma" + a).also { a.append("a") }\n }\n}\n```
2
0
['Kotlin']
0
goat-latin
Java solution
java-solution-by-anand_ms-83pe
\nclass Solution {\n public String toGoatLatin(String s) {\n\n String splitSentence[] = s.split(" ");\n String appendStr = "a";\n\n for
anand_ms
NORMAL
2020-08-20T03:14:42.374852+00:00
2020-08-20T03:14:42.374887+00:00
120
false
```\nclass Solution {\n public String toGoatLatin(String s) {\n\n String splitSentence[] = s.split(" ");\n String appendStr = "a";\n\n for (int i = 0; i < splitSentence.length; i++) {\n\n String word = splitSentence[i];\n char firstLetter = Character.toLowerCase(word.charAt...
2
0
[]
0
goat-latin
[C++] Best Method, Run Time 0ms, 100%
c-best-method-run-time-0ms-100-by-ravire-tuf0
Goat Latin Best Solution, Leetcode\n\nRuntime: 8 ms\nMemory: 6.5 MB, less than Top 84.27%\n\n\n\nclass Solution\n{\npublic:\n vector<string> split(string st
ravireddy07
NORMAL
2020-08-19T20:24:03.499023+00:00
2020-08-22T18:38:05.074252+00:00
105
false
### Goat Latin Best Solution, Leetcode\n\n**Runtime**: 8 ms\n**Memory**: 6.5 MB, less than Top 84.27%\n\n\n```\nclass Solution\n{\npublic:\n vector<string> split(string str, string token)\n {\n vector<string> result;\n while (str.size())\n {\n int index = str.find(token);\n ...
2
0
[]
0
goat-latin
2 different JS solution
2-different-js-solution-by-hon9g-wd21
vowels in set\n- Time Complexity: O(N)\n- Space Complexity: O(N)\nJavaScript\nconst vowels = new Set([\'a\', \'e\', \'i\', \'o\', \'u\', \'A\', \'E\', \'I\', \'
hon9g
NORMAL
2020-08-19T16:00:05.502282+00:00
2020-08-19T16:00:05.502334+00:00
249
false
## vowels in set\n- Time Complexity: O(N)\n- Space Complexity: O(N)\n```JavaScript\nconst vowels = new Set([\'a\', \'e\', \'i\', \'o\', \'u\', \'A\', \'E\', \'I\', \'O\', \'U\'])\n/**\n * @param {string} S\n * @return {string}\n */\nvar toGoatLatin = function(S) {\n return S.split(\' \').map(\n (word, i) => `...
2
0
['Ordered Set', 'JavaScript']
0
goat-latin
faster than 100%, easy solution
faster-than-100-easy-solution-by-jinkim-r10j
\nclass Solution {\npublic:\n string toGoatLatin(string S) {\n string word = "";\n vector<string> words;\n string res = "";\n for
jinkim
NORMAL
2020-08-19T14:40:00.370207+00:00
2020-08-19T14:40:00.370263+00:00
238
false
```\nclass Solution {\npublic:\n string toGoatLatin(string S) {\n string word = "";\n vector<string> words;\n string res = "";\n for (char c: S) {\n if (c == \' \') {\n words.push_back(word);\n word = "";\n } else {\n word...
2
2
['C']
0
goat-latin
Cpp code faster than 100% | Straight solution | Just do what is asked
cpp-code-faster-than-100-straight-soluti-fkxb
\nclass Solution {\npublic:\n bool checkVowel(char ch)\n {\n if(ch==\'a\' || ch==\'e\' || ch==\'i\' || ch==\'o\' || ch==\'u\' || ch==\'A\' || ch==\
mayanktolani19
NORMAL
2020-08-19T11:34:04.197800+00:00
2020-08-19T11:34:04.197834+00:00
127
false
```\nclass Solution {\npublic:\n bool checkVowel(char ch)\n {\n if(ch==\'a\' || ch==\'e\' || ch==\'i\' || ch==\'o\' || ch==\'u\' || ch==\'A\' || ch==\'E\' || ch==\'I\' || ch==\'O\' || ch==\'U\')\n return true;\n return false;\n }\n string toGoatLatin(string S) {\n S = S+" ";\...
2
0
[]
0
goat-latin
Python Super Simple&Clear Solution with explanations
python-super-simpleclear-solution-with-e-c6ql
\nclass Solution:\n def toGoatLatin(self, S: str) -> str:\n\t\n\t\t# split sentence to words\n splited_sentence = S.split(" ")\n\t\t\n\t\t# list of go
debbiealter
NORMAL
2020-08-19T07:50:21.274575+00:00
2020-08-19T08:11:50.868967+00:00
49
false
```\nclass Solution:\n def toGoatLatin(self, S: str) -> str:\n\t\n\t\t# split sentence to words\n splited_sentence = S.split(" ")\n\t\t\n\t\t# list of goat latin words\n goat_latin = []\n\t\t\n vowels = "aAeEiIoOuU"\n\t\t\n\t\t# to keep count of how many "a"s to add\n index = 1\n \...
2
2
['Python3']
0
goat-latin
C++ || Easy and simple
c-easy-and-simple-by-satifer-7ag7
```\nclass Solution {\npublic:\n string convert(string s, int count)\n {\n int len = s.length();\n string temp = "";\n if(s[0] == \'a
satifer
NORMAL
2020-07-21T16:26:33.508986+00:00
2020-07-21T16:26:33.509040+00:00
301
false
```\nclass Solution {\npublic:\n string convert(string s, int count)\n {\n int len = s.length();\n string temp = "";\n if(s[0] == \'a\' || s[0] == \'e\' || s[0] == \'i\' || s[0] == \'o\' || s[0] == \'u\' || s[0] == \'A\' || s[0] == \'E\' || s[0] == \'I\' || s[0] == \'O\' || s[0] == \'U\')\n ...
2
0
['C', 'C++']
0
goat-latin
[go] double 100% straightforward solution
go-double-100-straightforward-solution-b-k8fn
go\n// Runtime: 0 ms, faster than 100.00% of Go online submissions for Goat Latin.\n// Memory Usage: 2.2 MB, less than 100.00% of Go online submissions for Goat
wenfengg
NORMAL
2020-03-20T00:48:22.708339+00:00
2020-03-20T00:48:22.708394+00:00
60
false
```go\n// Runtime: 0 ms, faster than 100.00% of Go online submissions for Goat Latin.\n// Memory Usage: 2.2 MB, less than 100.00% of Go online submissions for Goat Latin.\nfunc toGoatLatin(S string) string {\n\tstrs := strings.Split(S, " ")\n\tvar as string\n\tfor i := range strs {\n\t\tas += "a"\n\t\tswitch strs[i][0]...
2
0
[]
1
goat-latin
JAVA - Very Easy Solution (Highly Efficient)
java-very-easy-solution-highly-efficient-29gz
\npublic String toGoatLatin(String S) {\n\tString[] words = S.split(" ");\n\tStringBuilder a = new StringBuilder(""), sol = new StringBuilder();\n\tSet<Characte
anubhavjindal
NORMAL
2019-11-28T07:37:55.954310+00:00
2019-11-28T07:38:55.280887+00:00
191
false
```\npublic String toGoatLatin(String S) {\n\tString[] words = S.split(" ");\n\tStringBuilder a = new StringBuilder(""), sol = new StringBuilder();\n\tSet<Character> vowels = new HashSet<>();\n\tvowels.add(\'a\'); vowels.add(\'e\'); vowels.add(\'i\'); vowels.add(\'o\'); vowels.add(\'u\'); \n\tfor(int i = 0; i<words.len...
2
1
[]
1
goat-latin
easy peasy python solution - split into list
easy-peasy-python-solution-split-into-li-y1xg
\tdef toGoatLatin(self, S: str) -> str:\n ls = S.split()\n for i in range(len(ls)):\n if ls[i][0].lower() in [\'a\', \'e\', \'i\', \'o\
lostworld21
NORMAL
2019-08-18T13:38:55.330326+00:00
2019-08-18T13:38:55.330382+00:00
149
false
\tdef toGoatLatin(self, S: str) -> str:\n ls = S.split()\n for i in range(len(ls)):\n if ls[i][0].lower() in [\'a\', \'e\', \'i\', \'o\', \'u\']:\n ls[i] = ls[i] + "ma" + (i+1)*"a"\n else:\n ls[i] = ls[i][1:] + ls[i][0] + "ma" + + (i+1)*"a"\n \n ...
2
0
[]
0
goat-latin
Javascript (four 1-line functions)
javascript-four-1-line-functions-by-stro-f1fy
\nconst toGoatLatin = S => S.split(\' \').map((w, i) => isVow(w) ? vow(w, i) : con(w, i)).join(\' \');\nconst isVow = w => [\'a\', \'e\', \'i\', \'o\', \'u\'].i
strom415
NORMAL
2019-07-07T03:18:08.407723+00:00
2019-07-07T03:18:08.407754+00:00
104
false
```\nconst toGoatLatin = S => S.split(\' \').map((w, i) => isVow(w) ? vow(w, i) : con(w, i)).join(\' \');\nconst isVow = w => [\'a\', \'e\', \'i\', \'o\', \'u\'].includes(w[0].toLowerCase());\nconst vow = (w, i) => w + \'ma\' + \'a\'.repeat(i + 1);\nconst con = (w, i) => w.slice(1, w.length) + w[0] + \'ma\' + \'a\'.rep...
2
0
[]
1
goat-latin
Haskell and Python Solution
haskell-and-python-solution-by-code_repo-49zk
Python:\n\ndef translate(i: int, w: str) -> str:\n return (w if w[0].lower() in \'aeiou\' else w[1:] + w[0]) + \'ma\' + i * \'a\'\n\nclass Solution:\n def
code_report
NORMAL
2019-04-27T07:34:31.344374+00:00
2019-04-27T07:34:31.344511+00:00
147
false
**Python:**\n```\ndef translate(i: int, w: str) -> str:\n return (w if w[0].lower() in \'aeiou\' else w[1:] + w[0]) + \'ma\' + i * \'a\'\n\nclass Solution:\n def toGoatLatin(self, s: str) -> str:\n return \' \'.join(translate(i, w) for i, w in enumerate(s.split(), 1))\n```\n**Haskell:**\n```\ntranslate :: ...
2
0
['Python3']
0
goat-latin
JavaScript solution 52 ms beats 100% submissions
javascript-solution-52-ms-beats-100-subm-d9ns
js\n/**\n * @param {string} S\n * @return {string}\n */\nvar toGoatLatin = function (S) {\n const VOWELS = new Set([\'A\', \'a\', \'E\', \'e\', \'I\', \'i\',
naansensical
NORMAL
2018-10-23T16:44:22.348767+00:00
2019-11-19T03:46:42.245699+00:00
139
false
```js\n/**\n * @param {string} S\n * @return {string}\n */\nvar toGoatLatin = function (S) {\n const VOWELS = new Set([\'A\', \'a\', \'E\', \'e\', \'I\', \'i\', \'O\', \'o\', \'U\', \'u\']);\n\n return S.split(\' \').map((word, i) => {\n const res = VOWELS.has(word[0]) ? word : word.substring(1) + word[0];...
2
0
[]
0