Skip to content

feat: add solutions for lc No.3043#5195

Merged
yanglbme merged 1 commit intomainfrom
dev
May 9, 2026
Merged

feat: add solutions for lc No.3043#5195
yanglbme merged 1 commit intomainfrom
dev

Conversation

@yanglbme
Copy link
Copy Markdown
Member

@yanglbme yanglbme commented May 9, 2026

No description provided.

Copilot AI review requested due to automatic review settings May 9, 2026 05:04
@idoocs idoocs added core team Issues or pull requests from core team cpp Issues or Pull requests relate to .cpp code go Issues or Pull requests relate to .go code java Issues or Pull requests relate to .java code js Issues or Pull requests relate to .js code md Issues or Pull requests relate to .md files py Issues or Pull requests relate to .py code rs Issues or Pull requests relate to .rs code ts Issues or Pull requests relate to .ts code labels May 9, 2026
@yanglbme yanglbme merged commit be7598c into main May 9, 2026
18 checks passed
@yanglbme yanglbme deleted the dev branch May 9, 2026 05:04
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates and expands the multi-language solution set for LeetCode 3043. Find the Length of the Longest Common Prefix within the solution/3000-3099/3043... directory, including synchronizing the README code snippets with the updated implementations.

Changes:

  • Optimized the prefix search across several languages by breaking early on the first (longest) matching prefix per arr2 number.
  • Switched from tracking the best length (ans) to tracking the best matching prefix value (mx) and deriving the length at the end.
  • Added a new Rust solution and updated both README.md and README_EN.md to include it and reflect code changes.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 12 comments.

Show a summary per file
File Description
solution/3000-3099/3043.Find the Length of the Longest Common Prefix/Solution.ts Updates TS solution to track mx and compute final length from it.
solution/3000-3099/3043.Find the Length of the Longest Common Prefix/Solution.rs Adds Rust solution using a HashSet of prefixes and mx.
solution/3000-3099/3043.Find the Length of the Longest Common Prefix/Solution.py Updates Python solution to track mx and compute final length once.
solution/3000-3099/3043.Find the Length of the Longest Common Prefix/Solution.js Updates JS solution to track mx and compute final length from it.
solution/3000-3099/3043.Find the Length of the Longest Common Prefix/Solution.java Updates Java solution to track mx and compute final length once.
solution/3000-3099/3043.Find the Length of the Longest Common Prefix/Solution.go Updates Go solution to track mx and compute length via strconv.Itoa(mx).
solution/3000-3099/3043.Find the Length of the Longest Common Prefix/Solution.cpp Updates C++ solution to track mx and compute final length from it.
solution/3000-3099/3043.Find the Length of the Longest Common Prefix/README.md Updates Chinese README snippets (incl. adding Rust snippet) to match implementations.
solution/3000-3099/3043.Find the Length of the Longest Common Prefix/README_EN.md Updates English README snippets (incl. adding Rust snippet) to match implementations.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

}
}
return ans;
return mx > 0 ? Math.floor(Math.log10(mx)) + 1 : 0;
}
}
return ans;
return mx > 0 ? Math.floor(Math.log10(mx)) + 1 : 0;
}
}
return ans;
return mx > 0 ? (int) log10(mx) + 1 : 0;
}
}
if mx > 0 {
(mx as f64).log10().floor() as i32 + 1
}
}
return ans;
return mx > 0 ? (int) log10(mx) + 1 : 0;
}
}
return ans;
return mx > 0 ? Math.floor(Math.log10(mx)) + 1 : 0;
}
}
return ans;
return mx > 0 ? (int) log10(mx) + 1 : 0;
}
}
}
return mx > 0 ? Math.floor(Math.log10(mx)) + 1 : 0;
}
}
if mx > 0 {
(mx as f64).log10().floor() as i32 + 1
}
}
return ans;
return mx > 0 ? Math.floor(Math.log10(mx)) + 1 : 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core team Issues or pull requests from core team cpp Issues or Pull requests relate to .cpp code go Issues or Pull requests relate to .go code java Issues or Pull requests relate to .java code js Issues or Pull requests relate to .js code md Issues or Pull requests relate to .md files py Issues or Pull requests relate to .py code rs Issues or Pull requests relate to .rs code ts Issues or Pull requests relate to .ts code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants