We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Validating phone numbers
Validating phone numbers
Sort by
recency
|
465 Discussions
|
Please Login in order to post a comment
def num(): n = int(input()) for _ in range (n): num=input().strip() if len (num)==10 and num[0] in "7,8,9" and num.isdigit(): print("YES") else: print("NO") num()
import re N=int(input()) for _ in range(N): S=input() if re.match(r'^[789]\d{9}$',S): print("YES") else: print("NO")
cannot pass one test case. cant understand why.
def insert(self,head,data): temp = Node(data) if head is None: head = temp return head current = head while current.next is not None: current = current.next current.next = temp return head
Problem solution in java programming. public static Node insert(Node head,int data){ // if list has no elements, return a new node if(head == null){ return new Node(data); }