单选15道,多选8道(好像),两道编程题 选择题大部分都是基础八股,哈希表问的比较多,单选最后一道题问了Spring的注解(具体内容忘了,因为不会所以乱选的)
然后是编程题
SELECT answer_data, ROUND(COUNT(issue_id) / COUNT(DISTINCT author_id), 2)
FROM answer_table
WHERE MONTH(answer_date) = 11
GROUP BY answer_date
Java、Go、Ruby
Java:
public static String[] longestSubstring(String input) {
ArrayList<String> res = new ArrayList<>();
if (input == null) return null;
Map<Character, Integer> hash = new HashMap<>();
int l = 0, r = 0, max_len = 0;
while (r < input.length()) {
Character c = input.charAt(r);
if (hash.containsKey(c) && hash.get(c) >= l)
l = hash.get(c) + 1;
hash.put(c, r);
int len = r - l + 1;
if (len > max_len) {
max_len = len;
res.clear();
res.add(input.substring(l, r+1));
} else if (len == max_len)
res.add(input.substring(l, r+1));
++r;
}
return (String[]) res.toArray();
}
Go:
func longestSubstring(input string) []string {
var res []string
if input == "" {
return nil
}
hash := make(map[rune]int)
l, r, maxLen := 0, 0, 0
for r < len(input) {
c := rune(input[r])
if _, ok := hash[c]; ok && hash[c] >= l {
l = hash[c] + 1
}
hash[c] = r
len := r - l + 1
if len > maxLen {
maxLen = len
res = []string{input[l : r+1]}
} else if len == maxLen {
res = append(res, input[l:r+1])
}
r++
}
return res
}
Ruby:
def longest_substring(input)
res = []
return nil if input.nil?
hash = {}
l = 0
r = 0
max_len = 0
while r < input.length
c = input[r]
if hash.key?(c) && hash[c] >= l
l = hash[c] + 1
end
hash[c] = r
len = r - l + 1
if len > max_len
max_len = len
res.clear
res.push(input[l..r])
elsif len == max_len
res.push(input[l..r])
end
r += 1
end
return res.to_a
end
#软件开发2023笔面经#