ããæ¡ä»¶ã§ã½ã¼ãããã¦ããIDã®ãªã¹ããä¸ãããã¦ããªãã¨ãªãè¿ãç¯å²ã§ãããã³ã°ããããã¨ããè¦ä»¶ããã£ããé åããã®ä»»æã®è¦ç´ ã®åãåºã㯠O(n) ã ãã©ãæ«å°¾ãæ«å°¾ããåºå®ããç¯å²ã®è¦ç´ ã«éã£ã¦è¨ãã° O(1) ãªã®ã§ãå¾ãã®æ¹ãããããã³ã°ãããªããè¦ç´ ãåãåºãã¦ããã° O(n) ã§ãããã³ã°ã§ããã¯ãã ãªãã«ãé£ãããã¨ã¯ç¡ã話ã§ã Python ã§æ¸ãã°ãããªãã list.pop() ãæ«å°¾ããã®ã¤ã³ããã¯ã¹ (-1 ãæå¾ã®è¦ç´ ã表ã) ã許ãã®ãå°å³ã«ä¾¿å©ã ã # coding: utf-8 def match(seq, r=100): from random import randint # å¥æ°åã®æã«å é å¨è¾ºã®è¦ç´ ããããã«ãªãã®ãå«ãªããå ã«å¾ãã®æ¹ã® # è¦ç´ ãåãé¤ãã¦å¶æ°ã«ãã¦ãããã¨. while len(seq) >= 2: # å¼æ°ãçç¥ããã¨æ«
{{#tags}}- {{label}}
{{/tags}}