List the three literal integer bases expressed in python code example
Example 1: Return a new RDD containing the distinct elements in this RDD.
sorted(sc.parallelize([1, 1, 2, 3]).distinct().collect())
# [1, 2, 3]
Example 2: Given a string S and a character C, return an array of integers representing the shortest distance from the character C in the string. javascript
class Solution {
public:
vector<int> shortestToChar(string S, char C) {
int n = S.size();
vector<int> r(n, n);
for (int i = 0; i < n; ++ i) {
if (S[i] == C) r[i] = 0;
}
for (int i = 1; i < n; ++ i) {
r[i] = min(r[i], r[i - 1] + 1);
}
for (int i = n - 2; i >= 0; -- i) {
r[i] = min(r[i], r[i + 1] + 1);
}
return r;
}
};