{"id":296008,"date":"2019-12-18T15:00:52","date_gmt":"2019-12-18T15:00:52","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=296008"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=296008","title":{"rendered":"\u0412\u044b\u043f\u0443\u0441\u043a#28: IT\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0430 \u2014 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u0438 \u0437\u0430\u0434\u0430\u0447\u0438 \u043e\u0442 \u0432\u0435\u0434\u0443\u0449\u0438\u0445 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0439"},"content":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/company\/spice\/blog\/479320\/\">\u041f\u0440\u0438\u0432\u0435\u0442! <br \/>  \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u0432 \u043d\u0430\u0448\u0435\u0439 \u0440\u0443\u0431\u0440\u0438\u043a\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u0441 \u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0439 \u0432 LinkedIn. <\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ge\/a8\/l4\/gea8l42pz1sdus804cr5qu5zsaw.png\" alt=\"image\"><\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0441 \u0445\u043e\u0434\u0443-\u0441 \u043b\u0435\u0442\u0443 \u0440\u0435\u0448\u0438\u0442\u0435 \u0438\u0445 \u0432\u0441\u0435 \u0438 \u0432\u0441\u0435\u0440\u044c\u0435\u0437 \u0437\u0430\u0434\u0443\u043c\u0430\u0435\u0442\u0435\u0441\u044c \u043e \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0434\u0430\u0442\u044c\u0441\u044f \u0432 LinkedIn \u2014 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u043c \u0432\u0430\u043c \u043f\u043e\u0441\u043b\u0443\u0448\u0430\u0442\u044c \u0432\u044b\u043f\u0443\u0441\u043a \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u043e\u0434\u043a\u0430\u0441\u0442\u0430.<\/p>\n<p>  \u041e\u043d, \u043f\u0440\u0430\u0432\u0434\u0430, \u043f\u0440\u043e \u043f\u0440\u043e\u0434\u0430\u043a\u0442\u043e\u0432, \u043d\u043e \u0432 \u043d\u0435\u043c \u043c\u044b \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0440\u0430\u0441\u0441\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u043c \u0443 \u0414\u043c\u0438\u0442\u0440\u0438\u044f \u0411\u0435\u0440\u0434\u043d\u0438\u043a\u043e\u0432\u0430 \u2014 Strategy &amp; Operations Director LinkedIn\u2019\u0430 \u043f\u0440\u043e \u0432\u0441\u0435 \u044d\u0442\u0430\u043f\u044b \u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0439 \u0432 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044e. <\/p>\n<p>  \u0421\u043b\u0443\u0448\u0430\u0439\u0442\u0435, \u0433\u0434\u0435 \u0443\u0434\u043e\u0431\u043d\u043e \u2193<br \/>  <a href=\"https:\/\/clck.ru\/JKq22\">Apple \u041f\u043e\u0434\u043a\u0430\u0441\u0442\u044b<\/a> <br \/>  <a href=\"https:\/\/clck.ru\/JKq6j\">Google \u041f\u043e\u0434\u043a\u0430\u0441\u0442\u044b<\/a><br \/>  <a href=\"https:\/\/clck.ru\/JKqB9\">\u042f\u043d\u0434\u0435\u043a\u0441.\u041c\u0443\u0437\u044b\u043a\u0430<\/a> <br \/>  \u0418\u043b\u0438 \u043d\u0430 <a href=\"https:\/\/anchor.fm\/lovingit\">\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u043f\u043e\u0434\u043a\u0430\u0441\u0442\u0430<\/a> <\/p>\n<p>  \u0418 \u043a\u0441\u0442\u0430\u0442\u0438, \u043e\u0442\u0432\u0435\u0442\u044b \u043d\u0430 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u043a\u0438 \u0443\u0436\u0435 <a href=\"https:\/\/habr.com\/ru\/company\/spice\/blog\/478250\/\">\u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d\u044b<\/a>! \u0421\u0432\u0435\u0440\u044f\u0439\u0442\u0435\u0441\u044c \u0441 \u043d\u0438\u043c\u0438.<a name=\"habracut\"><\/a><\/p>\n<h2>\u0412\u043e\u043f\u0440\u043e\u0441\u044b<\/h2>\n<p>  1. <b>Monty Hall problem<\/b>  <\/p>\n<blockquote><p>Suppose you\u2019re on a game show, and you\u2019re given the choice of three doors: Behind one door is a car; behind the others, goats. You pick a door, say No. 1, and the host, who knows what\u2019s behind the doors, opens another door, say No. 3, which has a goat. He then says to you, \u201cDo you want to pick door No. 2?\u201d<br \/>  Is it to your advantage to switch your choice?<\/p><\/blockquote>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/o0\/gd\/pz\/o0gdpzktjf_r3cpwinrg3jzzaja.png\" alt=\"image\">  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0435\u0440\u0435\u0432\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0432\u044b \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0435\u0441\u044c \u043d\u0430 \u0438\u0433\u0440\u043e\u0432\u043e\u043c \u0448\u043e\u0443, \u0438 \u0432\u0430\u043c \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u044b\u0431\u043e\u0440 \u0438\u0437 \u0442\u0440\u0435\u0445 \u0434\u0432\u0435\u0440\u0435\u0439: \u0437\u0430 \u043e\u0434\u043d\u043e\u0439 \u0434\u0432\u0435\u0440\u044c\u044e-\u0430\u0432\u0442\u043e\u043c\u043e\u0431\u0438\u043b\u044c; \u0437\u0430 \u0434\u0440\u0443\u0433\u0438\u043c\u0438-\u043a\u043e\u0437\u044b. \u0412\u044b \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442\u0435 \u0434\u0432\u0435\u0440\u044c, \u0441\u043a\u0430\u0436\u0435\u043c, \u21161, \u0438 \u0432\u0435\u0434\u0443\u0449\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u043d\u0430\u0435\u0442, \u0447\u0442\u043e \u0437\u0430 \u0434\u0432\u0435\u0440\u044f\u043c\u0438, \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u0434\u0440\u0443\u0433\u0443\u044e \u0434\u0432\u0435\u0440\u044c, \u0441\u043a\u0430\u0436\u0435\u043c, \u21163, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0435\u0441\u0442\u044c \u043a\u043e\u0437\u0430. \u0417\u0430\u0442\u0435\u043c \u043e\u043d \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u0432\u0430\u043c \u00ab\u0425\u043e\u0442\u0438\u0442\u0435 \u043b\u0438 \u0432\u044b \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0434\u0432\u0435\u0440\u044c \u21162?\u00bb<br \/>  \u0412\u044b\u0433\u043e\u0434\u043d\u043e \u043b\u0438 \u0432\u0430\u043c \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c \u0441\u0432\u043e\u0439 \u0432\u044b\u0431\u043e\u0440?<\/div>\n<\/div>\n<p>  2. <b>Find the Jar with contaminated pills<\/b>  <\/p>\n<blockquote><p>You have 5 jars of pills. Each pill weighs 10 grams, except for contaminated pills contained in one jar, where each pill weighs 9 grams. Given a scale, how could you tell which jar had the contaminated pills in just one measurement?<\/p><\/blockquote>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0435\u0440\u0435\u0432\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\u0423 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c 5 \u0431\u0430\u043d\u043e\u043a \u0442\u0430\u0431\u043b\u0435\u0442\u043e\u043a. \u041a\u0430\u0436\u0434\u0430\u044f \u0442\u0430\u0431\u043b\u0435\u0442\u043a\u0430 \u0432\u0435\u0441\u0438\u0442 10 \u0433\u0440\u0430\u043c\u043c\u043e\u0432, \u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0437\u0430\u0440\u0430\u0436\u0451\u043d\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0435\u0442\u043e\u043a, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0445\u0441\u044f \u0432 \u043e\u0434\u043d\u043e\u0439 \u0431\u0430\u043d\u043a\u0435, \u0433\u0434\u0435 \u043a\u0430\u0436\u0434\u0430\u044f \u0442\u0430\u0431\u043b\u0435\u0442\u043a\u0430 \u0432\u0435\u0441\u0438\u0442 9 \u0433\u0440\u0430\u043c\u043c\u043e\u0432. \u0423\u0447\u0438\u0442\u044b\u0432\u0430\u044f \u043c\u0430\u0441\u0448\u0442\u0430\u0431, \u043a\u0430\u043a \u0432\u044b \u043c\u043e\u0433\u043b\u0438 \u0431\u044b \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0432 \u043a\u0430\u043a\u043e\u0439 \u0431\u0430\u043d\u043a\u0435 \u0431\u044b\u043b\u0438 \u0437\u0430\u0440\u0430\u0436\u0435\u043d\u043d\u044b\u0435 \u0442\u0430\u0431\u043b\u0435\u0442\u043a\u0438, \u0432\u0441\u0435\u0433\u043e \u0437\u0430 \u043e\u0434\u043d\u043e \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u0435?<\/div>\n<\/div>\n<p>  <\/p>\n<h2>\u0417\u0430\u0434\u0430\u0447\u0438<\/h2>\n<p>  1. <b>Distinct Substrings<\/b>  <\/p>\n<blockquote><p>Given a string S consisting of uppercase alphabetic characters. Return the number of different substrings of size 2 that appear in S as contiguous substrings.<\/p>\n<p>  <b>Input:<\/b> The first line contains &#8216;T&#8217; denoting the number of testcases. Then follows description of test cases. The next T lines contains the string S.<\/p>\n<p>  <b>Output:<\/b> Output the number of different substrings of size 2 in S.<\/p>\n<p>  <b>Constraints:<\/b><br \/>  <code>1&lt;=T&lt;=50<br \/>  1&lt;=|S|&lt;=100 <\/code><\/p>\n<p>  <b>Example:<br \/>  Input :<\/b><br \/>  <code>2<br \/>  ABCAB<br \/>  XYZ<\/code><\/p>\n<p>  <b>Output:<\/b><br \/>  <code>3<br \/>  2<\/code><\/p>\n<p>  <b>Explanation:<\/b> For \u00abABCAB\u00bb, the three distinct substrings of size 2 are \u00abAB\u00bb, \u00abBC\u00bb and \u00abCA\u00bb. For \u00abXYZ\u00bb, the two distinct substrings of size 2 are \u00abXY\u00bb and \u00abYZ\u00bb.<\/p><\/blockquote>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0435\u0440\u0435\u0432\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\u0414\u0430\u043d\u0430 \u0441\u0442\u0440\u043e\u043a\u0430 S, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0430\u044f \u0438\u0437 \u043f\u0440\u043e\u043f\u0438\u0441\u043d\u044b\u0445 \u0431\u0443\u043a\u0432\u0435\u043d\u043d\u044b\u0445 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432. \u0412\u0435\u0440\u043d\u0438\u0442\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043f\u043e\u0434\u0441\u0442\u0440\u043e\u043a \u0440\u0430\u0437\u043c\u0435\u0440\u0430 2, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u044e\u0442\u0441\u044f \u0432 S \u043a\u0430\u043a \u0441\u043c\u0435\u0436\u043d\u044b\u0435 \u043f\u043e\u0434\u0441\u0442\u0440\u043e\u043a\u0438.<\/p>\n<p>  <b>\u0412\u0432\u043e\u0434:<\/b> \u041f\u0435\u0440\u0432\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 &#8216;T&#8217;, \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u044e\u0449\u0435\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0442\u0435\u0441\u0442\u043e\u0432. \u0414\u0430\u043b\u0435\u0435 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0442\u0435\u0441\u0442\u043e\u0432. \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 T \u0441\u0442\u0440\u043e\u043a \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442 \u0441\u0442\u0440\u043e\u043a\u0443 S.<\/p>\n<p>  <b>\u0412\u044b\u0445\u043e\u0434:<\/b> \u0412\u044b\u0432\u0435\u0434\u0438\u0442\u0435 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043f\u043e\u0434\u0441\u0442\u0440\u043e\u043a \u0440\u0430\u0437\u043c\u0435\u0440\u0430 2 \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 S.<\/p>\n<p>  <b>\u041e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f:<\/b><br \/>  <code>1&lt; = T&lt; = 50<br \/>  1&lt;= \/ S \/ &lt; = 100<\/code><\/p>\n<p>  <b>\u041f\u0440\u0438\u043c\u0435\u0440:<br \/>  \u0412\u0432\u043e\u0434:<\/b><br \/>  <code>2<br \/>  ABCAB<br \/>  XYZ<\/code><\/p>\n<p>  <b>\u0412\u044b\u0445\u043e\u0434:<\/b><br \/>  <code>3<br \/>  2<\/code><\/p>\n<p>  \u041f\u043e\u044f\u0441\u043d\u0435\u043d\u0438\u0435: \u0434\u043b\u044f \u00abABCAB\u00bb \u0442\u0440\u0435\u043c\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c\u0438 \u043f\u043e\u0434\u0441\u0442\u0440\u043e\u043a\u0430\u043c\u0438 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 2 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u00abAB\u00bb, \u00abBC\u00bb \u0438 \u00abCA\u00bb. \u0414\u043b\u044f \u00abXYZ\u00bb, \u0434\u0432\u0435 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u0434\u0441\u0442\u0440\u043e\u043a\u0438 \u0441 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c 2 \u044d\u0442\u043e \u00abXY\u00bb \u0438 \u00abYZ\u00bb.<\/p><\/div>\n<\/div>\n<p>  2. <b>Longest consecutive subsequence<\/b>  <\/p>\n<blockquote><p>Given an array <b>arr[]<\/b> of positive integers. Find the length of the longest sub-sequence such that elements in the subsequence are consecutive integers, the <b>consecutive numbers can be in any order.<\/b><\/p>\n<p>  <b>Input:<\/b><br \/>  The first line of input contains T, number of test cases. First line of line each test case contains a single integer N.<br \/>  Next line contains N integer array.<\/p>\n<p>  <b>Output:<\/b><br \/>  Print the output of each test case in a seprate line.<\/p>\n<p>  <b>Constraints:<\/b><br \/>  <code>1 &lt;= T &lt;= 100<br \/>  1 &lt;= N &lt;= 105<br \/>  0 &lt;= a[i] &lt;= 105<\/code><\/p>\n<p>  <b>Example:<br \/>  Input:<\/b><br \/>  <code>2<br \/>  7<br \/>  2 6 1 9 4 5 3<br \/>  7<br \/>  1 9 3 10 4 20 2<\/code><\/p>\n<p>  <b>Output:<\/b><br \/>  <code>6<br \/>  4<\/code><\/p>\n<p>  <b>Explanation:<br \/>  Testcase 1: <\/b> The consecutive numbers here are 1, 2, 3, 4, 5, 6. These 6 numbers form the longest consecutive subsquence.<\/p>\n<p>  <b>Testcase2:<\/b> 1, 2, 3, 4 is the longest consecutive subsequence.<\/p><\/blockquote>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0435\u0440\u0435\u0432\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\u0414\u0430\u043d \u043c\u0430\u0441\u0441\u0438\u0432 <b>arr[]<\/b> \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0446\u0435\u043b\u044b\u0445 \u0447\u0438\u0441\u0435\u043b. \u041d\u0430\u0439\u0442\u0438 \u0434\u043b\u0438\u043d\u0443 \u0441\u0430\u043c\u043e\u0439 \u0434\u043b\u0438\u043d\u043d\u043e\u0439 \u043f\u043e\u0434\u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0442\u0430\u043a\u043e\u0439, \u0447\u0442\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0432 \u043f\u043e\u0434\u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u0446\u0435\u043b\u044b\u043c\u0438 \u0447\u0438\u0441\u043b\u0430\u043c\u0438, <b>\u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0447\u0438\u0441\u043b\u0430 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0432 \u043b\u044e\u0431\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435<\/b>.<\/p>\n<p>  <b>\u0412\u0432\u043e\u0434:<\/b><br \/>  \u041f\u0435\u0440\u0432\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u0432\u0432\u043e\u0434\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 T, \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u0435\u0432. \u041f\u0435\u0440\u0432\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043e\u0434\u043d\u043e \u0446\u0435\u043b\u043e\u0435 \u0447\u0438\u0441\u043b\u043e N.<br \/>  \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 N \u0446\u0435\u043b\u044b\u0445 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432.<\/p>\n<p>  <b>\u0412\u044b\u0445\u043e\u0434:<\/b><br \/>  \u0412\u044b\u0432\u0435\u0434\u0438\u0442\u0435 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0430 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435.<\/p>\n<p>  <b>\u041e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f:<\/b><br \/>  <code>1 &lt; = T &lt; = 100<br \/>  1 &lt; = N &lt; = 105<br \/>  0 &lt;= a[i] &lt; = 105<\/code><\/p>\n<p>  <b>\u041f\u0440\u0438\u043c\u0435\u0440:<br \/>  \u0412\u0432\u043e\u0434:<\/b><br \/>  <code>2<br \/>  7<br \/>  2 6 1 9 4 5 3<br \/>  7<br \/>  1 9 3 10 4 20 2<\/code><\/p>\n<p>  <b>\u0412\u044b\u0445\u043e\u0434:<\/b><br \/>  <code>6<br \/>  4<\/code><\/p>\n<p>  <b>\u041e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435:<br \/>  \u0422\u0435\u0441\u0442 1:<\/b> \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043d\u043e\u043c\u0435\u0440\u0430 \u0437\u0434\u0435\u0441\u044c 1, 2, 3, 4, 5, 6. \u042d\u0442\u0438 6 \u0447\u0438\u0441\u0435\u043b \u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0442 \u0441\u0430\u043c\u044b\u0439 \u0434\u043b\u0438\u043d\u043d\u044b\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u043e\u0434\u0437\u0430\u043f\u0440\u043e\u0441.<\/p>\n<p>  <b>\u0422\u0435\u0441\u0442 2:<\/b> 1, 2, 3, 4 \u2014 \u0421\u0430\u043c\u0430\u044f \u0434\u043b\u0438\u043d\u043d\u0430\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u043f\u043e\u0434\u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c.<\/div>\n<\/div>\n<p>  3. <b>Distinct palindromic substrings<\/b>  <\/p>\n<blockquote><p>Given a string of lowercase ASCII characters, find all distinct continuous palindromic sub-strings of it.<\/p>\n<p>  <b>Input:<\/b><br \/>  The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. Each test case contains a string.<\/p>\n<p>  <b>Output:<\/b><br \/>  Print the count of distinct continuous palindromic sub-strings of it.<\/p>\n<p>  <b>Constraints:<\/b><br \/>  <code>1&lt;=T&lt;=10^5<br \/>  1&lt;=length of string&lt;=10^5<\/code><\/p>\n<p>  <b>Example:<br \/>  Input:<\/b><br \/>  <code>2<br \/>  abaaa<br \/>  geek<\/code><\/p>\n<p>  <b>Output:<\/b><br \/>  <code>5<br \/>  4<\/code><\/p><\/blockquote>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0435\u0440\u0435\u0432\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\u0414\u0430\u043d\u0430 \u0441\u0442\u0440\u043e\u043a\u0430 \u0441\u0442\u0440\u043e\u0447\u043d\u044b\u0445 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 ASCII, \u043d\u0430\u0439\u0434\u0438\u0442\u0435 \u0432\u0441\u0435 \u0435\u0435 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u043d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u044b\u0435 \u043f\u0430\u043b\u0438\u043d\u0434\u0440\u043e\u043c\u043d\u044b\u0435 \u043f\u043e\u0434\u0441\u0442\u0440\u043e\u043a\u0438.<\/p>\n<p>  <b>\u0412\u0432\u043e\u0434:<\/b><br \/>  \u041f\u0435\u0440\u0432\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0446\u0435\u043b\u043e\u0435 \u0447\u0438\u0441\u043b\u043e T, \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u044e\u0449\u0435\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0442\u0435\u0441\u0442\u043e\u0432. \u0417\u0430\u0442\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0442 \u0442\u0435\u0441\u0442\u044b. \u041a\u0430\u0436\u0434\u044b\u0439 \u0442\u0435\u0441\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0441\u0442\u0440\u043e\u043a\u0443.<\/p>\n<p>  <b>\u0412\u044b\u0445\u043e\u0434:<\/b><br \/>  \u0412\u044b\u0432\u0435\u0434\u0438\u0442\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u043d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u044b\u0445 \u043f\u0430\u043b\u0438\u043d\u0434\u0440\u043e\u043c\u043d\u044b\u0445 \u043f\u043e\u0434\u0441\u0442\u0440\u043e\u043a \u044d\u0442\u043e\u0433\u043e \u0442\u0438\u043f\u0430.<\/p>\n<p>  <b>\u041e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f:<\/b><br \/>  <code>1&lt; = T&lt;=10^5<br \/>  1&lt; = \u0434\u043b\u0438\u043d\u0430 \u0441\u0442\u0440\u043e\u043a\u0438&lt;=10^5<\/code><\/p>\n<p>  <b>\u041f\u0440\u0438\u043c\u0435\u0440:<br \/>  \u0412\u0432\u043e\u0434:<\/b><br \/>  <code>2<br \/>  abaaa<br \/>  geek<\/code><\/p>\n<p>  <b>\u0412\u044b\u0445\u043e\u0434:<\/b><br \/>  <code>5<br \/>  4<\/code><\/div>\n<\/div>\n<p>  \u041e\u0442\u0432\u0435\u0442\u044b \u043d\u0430 \u0437\u0430\u0434\u0430\u0447\u0438 \u0431\u0443\u0434\u0443\u0442 \u0434\u0430\u043d\u044b \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043d\u0435\u0434\u0435\u043b\u0438 \u2014 \u0443\u0441\u043f\u0435\u0439\u0442\u0435 \u0440\u0435\u0448\u0438\u0442\u044c. \u0423\u0434\u0430\u0447\u0438!<\/div>\n<p>               <script class=\"js-mediator-script\">!function(e){function t(t,n){if(!(n in e)){for(var r,a=e.document,i=a.scripts,o=i.length;o--;)if(-1!==i[o].src.indexOf(t)){r=i[o];break}if(!r){r=a.createElement(\"script\"),r.type=\"text\/javascript\",r.async=!0,r.defer=!0,r.src=t,r.charset=\"UTF-8\";var d=function(){var e=a.getElementsByTagName(\"script\")[0];e.parentNode.insertBefore(r,e)};\"[object Opera]\"==e.opera?a.addEventListener?a.addEventListener(\"DOMContentLoaded\",d,!1):e.attachEvent(\"onload\",d):d() } } }t(\"\/\/mediator.mail.ru\/script\/2820404\/\",\"_mediator\")}(window);<\/script>      <br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/company\/spice\/blog\/479320\/\"> https:\/\/habr.com\/ru\/company\/spice\/blog\/479320\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/company\/spice\/blog\/479320\/\">\u041f\u0440\u0438\u0432\u0435\u0442! <br \/>  \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u0432 \u043d\u0430\u0448\u0435\u0439 \u0440\u0443\u0431\u0440\u0438\u043a\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u0441 \u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0439 \u0432 LinkedIn. <\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ge\/a8\/l4\/gea8l42pz1sdus804cr5qu5zsaw.png\" alt=\"image\"><\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0441 \u0445\u043e\u0434\u0443-\u0441 \u043b\u0435\u0442\u0443 \u0440\u0435\u0448\u0438\u0442\u0435 \u0438\u0445 \u0432\u0441\u0435 \u0438 \u0432\u0441\u0435\u0440\u044c\u0435\u0437 \u0437\u0430\u0434\u0443\u043c\u0430\u0435\u0442\u0435\u0441\u044c \u043e \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0434\u0430\u0442\u044c\u0441\u044f \u0432 LinkedIn \u2014 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u043c \u0432\u0430\u043c \u043f\u043e\u0441\u043b\u0443\u0448\u0430\u0442\u044c \u0432\u044b\u043f\u0443\u0441\u043a \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u043e\u0434\u043a\u0430\u0441\u0442\u0430.<\/p>\n<p>  \u041e\u043d, \u043f\u0440\u0430\u0432\u0434\u0430, \u043f\u0440\u043e \u043f\u0440\u043e\u0434\u0430\u043a\u0442\u043e\u0432, \u043d\u043e \u0432 \u043d\u0435\u043c \u043c\u044b \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0440\u0430\u0441\u0441\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u043c \u0443 \u0414\u043c\u0438\u0442\u0440\u0438\u044f \u0411\u0435\u0440\u0434\u043d\u0438\u043a\u043e\u0432\u0430 \u2014 Strategy &amp; Operations Director LinkedIn\u2019\u0430 \u043f\u0440\u043e \u0432\u0441\u0435 \u044d\u0442\u0430\u043f\u044b \u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0439 \u0432 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044e. <\/p>\n<p>  \u0421\u043b\u0443\u0448\u0430\u0439\u0442\u0435, \u0433\u0434\u0435 \u0443\u0434\u043e\u0431\u043d\u043e \u2193<br \/>  <a href=\"https:\/\/clck.ru\/JKq22\">Apple \u041f\u043e\u0434\u043a\u0430\u0441\u0442\u044b<\/a> <br \/>  <a href=\"https:\/\/clck.ru\/JKq6j\">Google \u041f\u043e\u0434\u043a\u0430\u0441\u0442\u044b<\/a><br \/>  <a href=\"https:\/\/clck.ru\/JKqB9\">\u042f\u043d\u0434\u0435\u043a\u0441.\u041c\u0443\u0437\u044b\u043a\u0430<\/a> <br \/>  \u0418\u043b\u0438 \u043d\u0430 <a href=\"https:\/\/anchor.fm\/lovingit\">\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u043f\u043e\u0434\u043a\u0430\u0441\u0442\u0430<\/a> <\/p>\n<p>  \u0418 \u043a\u0441\u0442\u0430\u0442\u0438, \u043e\u0442\u0432\u0435\u0442\u044b \u043d\u0430 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u043a\u0438 \u0443\u0436\u0435 <a href=\"https:\/\/habr.com\/ru\/company\/spice\/blog\/478250\/\">\u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d\u044b<\/a>! \u0421\u0432\u0435\u0440\u044f\u0439\u0442\u0435\u0441\u044c \u0441 \u043d\u0438\u043c\u0438.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-296008","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/296008","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=296008"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/296008\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=296008"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=296008"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=296008"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}