Validate IPv4 (basic)
Java
Medium
4 views
Problem Description
Task: validate 4 parts (0..255) without leading plus. Input as int[4].
Output Format
Return value
Constraints
Each part must be 0..255.
Official Solution
static boolean isValidIPv4(int[] p){if(p.length!=4) return false;for(int x:p) if(x<0||x>255) return false;return true;}
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!