Skip to content

Commit 9d3efbd

Browse files
add 2562
1 parent 05aa334 commit 9d3efbd

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ _If you like this project, please leave me a star._ ★
88

99
| # | Title | Solutions | Video | Difficulty | Tag
1010
|------|----------------|------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------|----------------------------------|-------------
11+
| 2562 |[Find the Array Concatenation Value](https://leetcode.com/problems/find-the-array-concatenation-value/)| [Java](../master/src/main/java/com/fishercoder/solutions/_2562.java) | | Easy |
1112
| 2559 |[Count Vowel Strings in Ranges](https://leetcode.com/problems/count-vowel-strings-in-ranges/)| [Java](../master/src/main/java/com/fishercoder/solutions/_2559.java) | | Medium |
1213
| 2558 |[Take Gifts From the Richest Pile](https://leetcode.com/problems/take-gifts-from-the-richest-pile/)| [Java](../master/src/main/java/com/fishercoder/solutions/_2558.java) | | Easy |
1314
| 2554 |[Maximum Number of Integers to Choose From a Range I](https://leetcode.com/problems/maximum-number-of-integers-to-choose-from-a-range-i/)| [Java](../master/src/main/java/com/fishercoder/solutions/_2554.java) | | Medium |
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.fishercoder.solutions;
2+
3+
public class _2562 {
4+
public static class Solution1 {
5+
public long findTheArrayConcVal(int[] nums) {
6+
long sum = 0;
7+
int left = 0;
8+
int right = nums.length - 1;
9+
while (left < right) {
10+
int first = nums[left++];
11+
int last = nums[right--];
12+
int times = 1;
13+
sum += last;
14+
while (last != 0) {
15+
last /= 10;
16+
times *= 10;
17+
}
18+
sum += first * times;
19+
}
20+
if (left == right) {
21+
sum += nums[left];
22+
}
23+
return sum;
24+
}
25+
}
26+
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy