Category : null

My question is related to "longest common prefix" problem in LeetCode.(https://leetcode.com/problems/longest-common-prefix/) Here is my code: #include <string> class Solution { public: string longestCommonPrefix(vector<string>& strs) { int cnt = 0; string result = ""; char ch = ‘ ‘; char standard = ‘ ‘; for(int i=0; i<strs.size(); i++){ if(strs[i].size() == 0) return result; } if(strs.size() == ..

Read more