<commit_before>// Time:  O(n * k), k is the length of the common prefix
// Space: O(1)

class Solution {
public:
    string longestCommonPrefix(vector<string>& strs) {
        if (strs.empty()) {
            return "";
        }

        for (int i = 0; i < strs[0].length(); ++i) {
            for (const auto& str : strs) {
                if (str[i] != strs[0][i]) {
                    return strs[0].substr(0, i);
                }
            }
        }<commit_msg>Update longest-common-prefix.cpp<commit_after>// Time:  O(n * k), k is the length of the common prefix
// Space: O(1)

class Solution {
public:
    string longestCommonPrefix(vector<string>& strs) {
        if (strs.empty()) {
            return "";
        }

        for (int i = 0; i < strs[0].length(); ++i) {
            for (const auto& str : strs) {
                if (i >= str.length() || str[i] != strs[0][i]) {
                    return strs[0].substr(0, i);
                }
            }
        }
{'fraction_non_alphanumeric': 0.15853658536585366, 'fraction_numerical': 0.012195121951219513, 'mean_word_length': 1.5127551020408163, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2335034', 'n_tokens_mistral': 323, 'n_tokens_neox': 311, 'n_words': 85}