We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 64c9108 commit 444ada3Copy full SHA for 444ada3
1903-largest-odd-number-in-string.js
@@ -0,0 +1,11 @@
1
+/**
2
+ * @param {string} num
3
+ * @return {string}
4
+ */
5
+const largestOddNumber = function(num) {
6
+ let idx= -1
7
+ for(let i = 0, n = num.length; i < n; i++) {
8
+ if((+num[i]) % 2 === 1) idx = i
9
+ }
10
+ return num.slice(0, idx+1)
11
+};
0 commit comments