ä¾ã«ãã£ã¦ StackOverflow ããã®ãã¿ã ãªã¹ãã®å¼ãç®ã¨ã¯ ãããªã¹ããããå¥ã®ãªã¹ãã«å«ã¾ããªãè¦ç´ ãåé¤ãã æ¬ä¼¼ã³ã¼ã # pseudocode x = [1, 2, 3, 4, 5] y = [2, 4] assert (x - y) == [1, 3, 5] ãã£ã«ã¿ã¼ã«ããã¢ããã¼ã å®ç¾©ããã®ã¾ã¾åãåã£ãç´ç²ãªã¢ããã¼ãã ãã ããlist 㧠in æ¼ç®åã使ãé (item in l) ã®å¹³åè¨ç®éã¯ãO(n) ã¨ãªããå ´åã«ãã£ã¦ã¯ãå¹çãæªããããããªãã x = [1, 2, 3, 4, 5] y = [2, 4] assert [item for item in x if item not in y] == [1, 3, 5] set ã使ãã¢ããã¼ã set ã¯ãå¼ãç®ãã§ããã®ã§ãä¸åº¦ set ã«å¤æãã¦ãã list ã«æ»ãã¢ããã¼ãã se
{{#tags}}- {{label}}
{{/tags}}