All prompts are owned by LeetCode. To view the prompt, click the title link above.
First completed : May 22, 2024
Last updated : August 01, 2024
Related Topics : Array, String
Acceptance Rate : 81.45 %
int countSeniors(char ** details, int detailsSize){
int output = 0;
for (int i = 0; i < detailsSize; i++) {
if ((details[i][11] - '0') * 10 + details[i][12] - '0' > 60) {
output++;
}
}
return output;
}
class Solution:
def countSeniors(self, details: List[str]) -> int:
counter = 0
for detail in details :
if int(detail[11:13]) > 60 :
counter += 1
return counter
class Solution:
def countSeniors(self, details: List[str]) -> int:
return sum([int(x[11:13]) > 60 for x in details])
class Solution:
def countSeniors(self, details: List[str]) -> int:
return [True for x in details if int(x[11:13]) > 60].count(True)
class Solution {
public int countSeniors(String[] details) {
int counter = 0;
for (String str : details) {
if (Integer.parseInt(str.substring(11,13)) > 60) {
counter++;
}
}
return counter;
}
}