{"id":8744,"date":"2021-09-09T20:16:03","date_gmt":"2021-09-09T17:16:03","guid":{"rendered":"https:\/\/elzero.org\/?p=8744"},"modified":"2022-08-07T07:07:34","modified_gmt":"2022-08-07T04:07:34","slug":"javascript-problems-solving-find-missing-letter-in-sequence","status":"publish","type":"post","link":"https:\/\/elzero.org\/old\/javascript-problems-solving-find-missing-letter-in-sequence\/","title":{"rendered":"Find Missing Letter in Sequence"},"content":{"rendered":"<h3>\u0627\u0644\u062d\u0644 01<\/h3>\r\n\r\n<script type=\"text\/plain\" class=\"language-javascript\">\r\nfunction findMissingLetterIn(givenLetters) {\r\n  let alpha = \"abcdefghijklmnopqrstuvwxyz\";\r\n  let start = alpha.indexOf(givenLetters[0]);\r\n\r\n  for (let i = 0; i < givenLetters.length; i++) {\r\n    \/\/ console.log(alpha[start + i]); \/\/ Loop On Alpha\r\n    \/\/ console.log(givenLetters[i]); \/\/ Loop On Given Letters\r\n    \/\/ console.log(\"#####\");\r\n    if (givenLetters[i] !== alpha[start + i]) {\r\n      return alpha[start + i];\r\n    }\r\n  }\r\n\r\n  return \"No Missing Letter In Sequence\";\r\n}\r\n\r\nconsole.log(findMissingLetterIn(\"defgi\")); \/\/ h\r\nconsole.log(findMissingLetterIn(\"abcdeghi\")); \/\/ f\r\nconsole.log(findMissingLetterIn(\"xyz\")); \/\/ No Missing Letter In Sequence\r\n<\/script>\r\n\r\n<hr class=\"separator\">\r\n\r\n<h3>\u0627\u0644\u062d\u0644 02<\/h3>\r\n\r\n<script type=\"text\/plain\" class=\"language-javascript\">\r\nfunction findMissingLetterIn(givenLetters) {\r\n  let alpha = \"abcdefghijklmnopqrstuvwxyz\";\r\n  let start = alpha.indexOf(givenLetters[0]); \/\/ 3\r\n  let len = givenLetters.length; \/\/ 5\r\n\r\n  for (let i = start; i < start + len; i++) {\r\n    if (!givenLetters.includes(alpha[i])) {\r\n      return alpha[i];\r\n    }\r\n  }\r\n  return \"No Missing Letters\";\r\n}\r\n\r\nconsole.log(findMissingLetterIn(\"defgi\")); \/\/ h\r\nconsole.log(findMissingLetterIn(\"abcdeghi\")); \/\/ f\r\nconsole.log(findMissingLetterIn(\"xyz\")); \/\/ No Missing Letter In Sequence\r\n<\/script>\r\n","protected":false},"excerpt":{"rendered":"<p>\u0627\u0644\u062d\u0644 01 \u0627\u0644\u062d\u0644 02<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1337],"tags":[],"class_list":["post-8744","post","type-post","status-publish","format-standard","hentry","category-problems-solving"],"_links":{"self":[{"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/posts\/8744","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/comments?post=8744"}],"version-history":[{"count":1,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/posts\/8744\/revisions"}],"predecessor-version":[{"id":8745,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/posts\/8744\/revisions\/8745"}],"wp:attachment":[{"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/media?parent=8744"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/categories?post=8744"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/tags?post=8744"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}