본문 바로가기
CodeSignal/Arcade

CodeSignal [47/60] isMAC48Address

by 벤진[Benzene] 2020. 5. 27.

Problem:

A media access control address (MAC address) is a unique identifier assigned to network interfaces for communications on the physical network segment.

The standard (IEEE 802) format for printing MAC-48 addresses in human-friendly form is six groups of two hexadecimal digits (0 to 9 or A to F), separated by hyphens (e.g. 01-23-45-67-89-AB).

Your task is to check by given string inputString whether it corresponds to MAC-48 address or not.

 

Example

  • For inputString = "00-1B-63-84-45-E6", the output should be
    isMAC48Address(inputString) = true;
  • For inputString = "Z1-1B-63-84-45-E6", the output should be
    isMAC48Address(inputString) = false;
  • For inputString = "not a MAC-48 address", the output should be
    isMAC48Address(inputString) = false.

-Summary-

1. data 를 '-' 으로 나누어 splitdata list 에 넣어준다.

2. split 된 data의 문자각각이 숫자 0-9 사이 또는 영문자 A-F 사이에 있는지 체크한다. 

3. 모든 체크후 pass하면 True 값 return 아닐경우 False return.

모든 문제에 대한 저작권은 CodeSignal 회사에 있습니다. [Copyright © 2020 BrainFights Inc. All rights reserved]

https://codesignal.com/

'CodeSignal > Arcade' 카테고리의 다른 글

CodeSignal [49/60] lineEncoding  (0) 2020.05.27
CodeSignal [48/60] isDigit  (0) 2020.05.27
CodeSignal [46/60] electionsWinners  (0) 2020.05.27
CodeSignal [45/60] buildPalindrome  (0) 2020.05.27
CodeSignal [44/60] findEmailDomain  (0) 2020.05.26

댓글