{"id":69,"date":"2021-09-13T23:03:45","date_gmt":"2021-09-13T14:03:45","guid":{"rendered":"https:\/\/th0x0472.net\/?p=69"},"modified":"2021-09-13T23:03:45","modified_gmt":"2021-09-13T14:03:45","slug":"hacker-rank%e3%81%8c%e6%a5%bd%e3%81%97%e3%81%84","status":"publish","type":"post","link":"https:\/\/th0x0472.net\/index.php\/2021\/09\/13\/69\/","title":{"rendered":"Hacker Rank\u304c\u697d\u3057\u3044"},"content":{"rendered":"<p>\u3068\u3042\u308b\u7d4c\u7def\u3067Hacker Rank\u3068\u3044\u3046\u30b5\u30a4\u30c8\u3092\u77e5\u308a\u307e\u3057\u305f\u3002\u8d85\u697d\u3057\u3044\u3067\u3059\u3002<!--more--><\/p>\n<p><a href=\"https:\/\/www.hackerrank.com\/\" target=\"_blank\" rel=\"noopener\">https:\/\/www.hackerrank.com\/<\/a><\/p>\n<p>\u8981\u306f\u30aa\u30f3\u30e9\u30a4\u30f3\u3067\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u306e\u554f\u984c\u3092\u89e3\u304f\u30b5\u30a4\u30c8\u306a\u306e\u3067\u3059\u304c\u3001bash\u304c\u3042\u308a\u307e\u3059\u3002<br \/>\n\u666e\u6bb5\u4f55\u6c17\u306a\u304f\u4f7f\u3063\u3066\u308b\u30b3\u30de\u30f3\u30c9\u306e\u77e5\u3089\u306a\u304b\u3063\u305f\u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u65b0\u305f\u306b\u77e5\u308b\u3053\u3068\u304c\u51fa\u6765\u305f\u308a\u3059\u308b\u3068\u5b09\u3057\u3044\u3067\u3059\u3002<br \/>\n\u554f\u984c\u306e\u8da3\u65e8\u3092\u7121\u8996\u3057\u3066\u8272\u3005\u306a\u89e3\u304d\u65b9\u3092\u8003\u3048\u308b\u306e\u3082\u697d\u3057\u3044\u3067\u3059\u3002<\/p>\n<p>\u4f8b\u3048\u3070<a href=\"https:\/\/www.hackerrank.com\/challenges\/bash-tutorials-read-in-an-array\/problem\" target=\"_blank\" rel=\"noopener\">\u3053\u306e\u554f\u984c<\/a>\u3002\u5358\u8a9e\u3092\u914d\u5217\u306b\u8aad\u307f\u8fbc\u3093\u30671\u5217\u306b\u3064\u306a\u3052\u3066\u51fa\u529b\u305b\u3088\u3068\u3044\u3046\u554f\u984c\u3067\u3059\u304c\u3001<em>xargs<\/em>\u3067\u77ac\u6bba\u3067\u3059\u3002<\/p>\n<p>Bash\u306e\u914d\u5217\u306e\u554f\u984c\u3067\u552f\u4e00Hard\u3068\u306a\u3063\u3066\u308b<a href=\"https:\/\/www.hackerrank.com\/challenges\/lonely-integer-2\/problem\" target=\"_blank\" rel=\"noopener\">\u3053\u306e\u554f\u984c\u3082<\/a>\u3001\u914d\u5217\u3092\u4f7f\u308f\u305a\u306b\u89e3\u3051\u307e\u3059\u3002\u3053\u3093\u306a\u89e3\u7b54\u3057\u3066\u5168\u30c6\u30b9\u30c8\u30b1\u30fc\u30b9\u3092\u30af\u30ea\u30a2\u3057\u307e\u3057\u305f\u3002\u914d\u5217\u3092\u4f7f\u3046\u65b9\u304c\u96e3\u3057\u3044\u3093\u3058\u3083\u306a\u3044\u304b\u306a\u3041\u3002<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code><\/code><\/pre>\n<div>\n<div><span>read;read\u00a0nums<\/span><\/div>\n<div><span>echo<\/span><span>\u00a0<\/span><span>$nums<\/span><span>\u00a0|\u00a0xargs\u00a0<\/span><span>-n<\/span><span>\u00a0<\/span><span>1<\/span><span>\u00a0|\u00a0<\/span><span>sort<\/span><span>\u00a0|\u00a0uniq\u00a0<\/span><span>-c<\/span><span>\u00a0|\u00a0<\/span><span>awk<\/span><span>\u00a0<\/span><span>&#8216;$1~1{print $2}&#8217;<\/span><\/div>\n<\/div>\n<\/div>\n<p>\u554f\u984c\u306f\u3053\u3093\u306a\u611f\u3058\u3067\u3059\uff1a\u4e8c\u884c\u306e\u5165\u529b\u304c\u4e0e\u3048\u3089\u308c\u307e\u3059\u3002\u4e8c\u884c\u76ee\u306f\u30b9\u30da\u30fc\u30b9\u533a\u5207\u308a\u306e\u6570\u5b57\u306e\u4e26\u3073\u3067\u3001\u4e00\u884c\u76ee\u306f\u4e8c\u884c\u76ee\u306b\u4f55\u500b\u306e\u6570\u5b57\u304c\u3042\u308b\u304b\u3092\u6559\u3048\u3066\u304f\u308c\u307e\u3059\u3002\u6c42\u3081\u3089\u308c\u3066\u3044\u308b\u306e\u306f\u3001\u4e8c\u884c\u76ee\u306e\u6570\u5b57\u306e\u4e26\u3073\u306e\u4e2d\u3067\u4e00\u56de\u3060\u3051\u51fa\u73fe\u3057\u305f\u6570\u5b57\u3092\u51fa\u529b\u3059\u308b\u3053\u3068\u3067\u3059\u3002<br \/>\n\u30cf\u30c3\u30ad\u30ea\u8a00\u3063\u3066\u3001<em>xargs | sort | uniq<\/em> \u307e\u3067\u306f\u810a\u9ac4\u53cd\u5c04\u3067\u3057\u305f\u306d\u3002<\/p>\n<p>\u305f\u3060\u3001<a href=\"https:\/\/www.hackerrank.com\/challenges\/fractal-trees-all\/problem\" target=\"_blank\" rel=\"noopener\">\u3053\u306e\u554f\u984c<\/a>\u3060\u3051\u306f\u89e3\u3051\u308b\u6c17\u304c\u3057\u307e\u305b\u3093\u3002\u4e0b\u304b\u3089\u63cf\u3044\u3066\u3044\u3063\u3066\u6700\u5f8c\u306b<em>tac<\/em>\u3059\u308c\u3070\u3044\u3044\u3093\u3060\u308d\u3046\u306a\u3068\u3044\u3046\u3053\u3068\u304f\u3089\u3044\u3057\u304b\u601d\u3044\u6d6e\u304b\u3073\u307e\u305b\u3093\u3002<\/p>\n<p>\u4eca\u56de\u306fBash\u306e\u4e8b\u3070\u304b\u308a\u66f8\u304d\u307e\u3057\u305f\u304c\u3001Python\u306e\u554f\u984c\u3082\u89e3\u3044\u3066\u3044\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3068\u3042\u308b\u7d4c\u7def\u3067Hacker Rank\u3068\u3044\u3046\u30b5\u30a4\u30c8\u3092\u77e5\u308a\u307e\u3057\u305f\u3002\u8d85\u697d\u3057\u3044\u3067\u3059\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-69","post","type-post","status-publish","format-standard","hentry","category-blog"],"_links":{"self":[{"href":"https:\/\/th0x0472.net\/index.php\/wp-json\/wp\/v2\/posts\/69","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/th0x0472.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/th0x0472.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/th0x0472.net\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/th0x0472.net\/index.php\/wp-json\/wp\/v2\/comments?post=69"}],"version-history":[{"count":2,"href":"https:\/\/th0x0472.net\/index.php\/wp-json\/wp\/v2\/posts\/69\/revisions"}],"predecessor-version":[{"id":71,"href":"https:\/\/th0x0472.net\/index.php\/wp-json\/wp\/v2\/posts\/69\/revisions\/71"}],"wp:attachment":[{"href":"https:\/\/th0x0472.net\/index.php\/wp-json\/wp\/v2\/media?parent=69"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/th0x0472.net\/index.php\/wp-json\/wp\/v2\/categories?post=69"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/th0x0472.net\/index.php\/wp-json\/wp\/v2\/tags?post=69"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}