Advertisement
Guest User

Untitled

a guest
Mar 17th, 2025
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 25.96 KB | Gaming | 0 0
  1. <div class="section" id="list-of-all-problem-types">
  2. <h2>List of all Problem Types<a class="headerlink" href="#list-of-all-problem-types" title="Permalink to this headline"></a></h2>
  3. <p>The following is a list of all of the problem types that a Coding Contract can contain.
  4. The list contains the name of (i.e. the value returned by
  5. <code class="xref js js-func docutils literal notranslate"><span class="pre">getContractType()</span></code>) and a brief summary of the problem it poses.</p>
  6. <table border="1" class="docutils">
  7. <colgroup>
  8. <col width="31%" />
  9. <col width="69%" />
  10. </colgroup>
  11. <thead valign="bottom">
  12. <tr class="row-odd"><th class="head">Name</th>
  13. <th class="head">Problem Summary</th>
  14. </tr>
  15. </thead>
  16. <tbody valign="top">
  17. <tr class="row-even"><td>Find Largest Prime Factor</td>
  18. <td><div class="first last line-block">
  19. <div class="line">Given a number, find its largest prime factor. A prime factor</div>
  20. <div class="line">is a factor that is a prime number.</div>
  21. </div>
  22. </td>
  23. </tr>
  24. <tr class="row-odd"><td>Subarray with Maximum Sum</td>
  25. <td><div class="first last line-block">
  26. <div class="line">Given an array of integers, find the contiguous subarray (containing</div>
  27. <div class="line">at least one number) which has the largest sum and return that sum.</div>
  28. </div>
  29. </td>
  30. </tr>
  31. <tr class="row-even"><td>Total Ways to Sum</td>
  32. <td><div class="first last line-block">
  33. <div class="line">Given a number, how many different distinct ways can that number be written as</div>
  34. <div class="line">a sum of at least two positive integers?</div>
  35. </div>
  36. </td>
  37. </tr>
  38. <tr class="row-odd"><td>Total Ways to Sum II</td>
  39. <td><div class="first last line-block">
  40. <div class="line">You are given an array with two elements. The first element is an integer n.</div>
  41. <div class="line">The second element is an array of numbers representing the set of available integers.</div>
  42. <div class="line">How many different distinct ways can that number n be written as</div>
  43. <div class="line">a sum of integers contained in the given set?</div>
  44. <div class="line">You may use each integer in the set zero or more times.</div>
  45. </div>
  46. </td>
  47. </tr>
  48. <tr class="row-even"><td>Spiralize Matrix</td>
  49. <td><div class="first last line-block">
  50. <div class="line">Given an array of array of numbers representing a 2D matrix, return the</div>
  51. <div class="line">elements of that matrix in clockwise spiral order.</div>
  52. <div class="line"><br /></div>
  53. <div class="line">Example: The spiral order of</div>
  54. <div class="line"><br /></div>
  55. <div class="line-block">
  56. <div class="line">[1, 2, 3, 4]</div>
  57. <div class="line">[5, 6, 7, 8]</div>
  58. <div class="line">[9, 10, 11, 12]</div>
  59. <div class="line"><br /></div>
  60. </div>
  61. <div class="line">is [1, 2, 3, 4, 8, 12, 11, 10, 9, 5, 6, 7]</div>
  62. </div>
  63. </td>
  64. </tr>
  65. <tr class="row-odd"><td>Array Jumping Game</td>
  66. <td><div class="first last line-block">
  67. <div class="line">You are given an array of integers where each element represents the</div>
  68. <div class="line">maximum possible jump distance from that position. For example, if you</div>
  69. <div class="line">are at position i and your maximum jump length is n, then you can jump</div>
  70. <div class="line">to any position from i to i+n.</div>
  71. <div class="line"><br /></div>
  72. <div class="line">Assuming you are initially positioned at the start of the array, determine</div>
  73. <div class="line">whether you are able to reach the last index of the array.</div>
  74. </div>
  75. </td>
  76. </tr>
  77. <tr class="row-even"><td>Array Jumping Game II</td>
  78. <td><div class="first last line-block">
  79. <div class="line">You are given an array of integers where each element represents the</div>
  80. <div class="line">maximum possible jump distance from that position. For example, if you</div>
  81. <div class="line">are at position i and your maximum jump length is n, then you can jump</div>
  82. <div class="line">to any position from i to i+n.</div>
  83. <div class="line"><br /></div>
  84. <div class="line">Assuming you are initially positioned at the start of the array, determine</div>
  85. <div class="line">the minimum number of jumps to reach the end of the array.</div>
  86. <div class="line"><br /></div>
  87. <div class="line">If it’s impossible to reach the end, then the answer should be 0.</div>
  88. </div>
  89. </td>
  90. </tr>
  91. <tr class="row-odd"><td>Merge Overlapping Intervals</td>
  92. <td><div class="first last line-block">
  93. <div class="line">Given an array of intervals, merge all overlapping intervals. An interval</div>
  94. <div class="line">is an array with two numbers, where the first number is always less than</div>
  95. <div class="line">the second (e.g. [1, 5]).</div>
  96. <div class="line"><br /></div>
  97. <div class="line">The intervals must be returned in ASCENDING order.</div>
  98. <div class="line"><br /></div>
  99. <div class="line">Example:</div>
  100. <div class="line-block">
  101. <div class="line">[[1, 3], [8, 10], [2, 6], [10, 16]]</div>
  102. </div>
  103. <div class="line">merges into [[1, 6], [8, 16]]</div>
  104. </div>
  105. </td>
  106. </tr>
  107. <tr class="row-even"><td>Generate IP Addresses</td>
  108. <td><div class="first last line-block">
  109. <div class="line">Given a string containing only digits, return an array with all possible</div>
  110. <div class="line">valid IP address combinations that can be created from the string.</div>
  111. <div class="line"><br /></div>
  112. <div class="line">An octet in the IP address cannot begin with ‘0’ unless the number itself</div>
  113. <div class="line">is actually 0. For example, “192.168.010.1” is NOT a valid IP.</div>
  114. <div class="line"><br /></div>
  115. <div class="line">Examples:</div>
  116. <div class="line-block">
  117. <div class="line">25525511135 -&gt; [255.255.11.135, 255.255.111.35]</div>
  118. <div class="line">1938718066 -&gt; [193.87.180.66]</div>
  119. </div>
  120. </div>
  121. </td>
  122. </tr>
  123. <tr class="row-odd"><td>Algorithmic Stock Trader I</td>
  124. <td><div class="first last line-block">
  125. <div class="line">You are given an array of numbers representing stock prices, where the</div>
  126. <div class="line">i-th element represents the stock price on day i.</div>
  127. <div class="line"><br /></div>
  128. <div class="line">Determine the maximum possible profit you can earn using at most one</div>
  129. <div class="line">transaction (i.e. you can buy an sell the stock once).  If no profit</div>
  130. <div class="line">can be made, then the answer should be 0. Note that you must buy the stock</div>
  131. <div class="line">before you can sell it.</div>
  132. </div>
  133. </td>
  134. </tr>
  135. <tr class="row-even"><td>Algorithmic Stock Trader II</td>
  136. <td><div class="first last line-block">
  137. <div class="line">You are given an array of numbers representing stock prices, where the</div>
  138. <div class="line">i-th element represents the stock price on day i.</div>
  139. <div class="line"><br /></div>
  140. <div class="line">Determine the maximum possible profit you can earn using as many transactions</div>
  141. <div class="line">as you’d like. A transaction is defined as buying and then selling one</div>
  142. <div class="line">share of the stock. Note that you cannot engage in multiple transactions at</div>
  143. <div class="line">once. In other words, you must sell the stock before you buy it again. If no</div>
  144. <div class="line">profit can be made, then the answer should be 0.</div>
  145. </div>
  146. </td>
  147. </tr>
  148. <tr class="row-odd"><td>Algorithmic Stock Trader III</td>
  149. <td><div class="first last line-block">
  150. <div class="line">You are given an array of numbers representing stock prices, where the</div>
  151. <div class="line">i-th element represents the stock price on day i.</div>
  152. <div class="line"><br /></div>
  153. <div class="line">Determine the maximum possible profit you can earn using at most two</div>
  154. <div class="line">transactions. A transaction is defined as buying and then selling one share</div>
  155. <div class="line">of the stock. Note that you cannot engage in multiple transactions at once.</div>
  156. <div class="line">In other words, you must sell the stock before you buy it again. If no profit</div>
  157. <div class="line">can be made, then the answer should be 0.</div>
  158. </div>
  159. </td>
  160. </tr>
  161. <tr class="row-even"><td>Algorithmic Stock Trader IV</td>
  162. <td><div class="first last line-block">
  163. <div class="line">You are given an array with two elements. The first element is an integer k.</div>
  164. <div class="line">The second element is an array of numbers representing stock prices, where the</div>
  165. <div class="line">i-th element represents the stock price on day i.</div>
  166. <div class="line"><br /></div>
  167. <div class="line">Determine the maximum possible profit you can earn using at most k transactions.</div>
  168. <div class="line">A transaction is defined as buying and then selling one share of the stock.</div>
  169. <div class="line">Note that you cannot engage in multiple transactions at once. In other words,</div>
  170. <div class="line">you must sell the stock before you can buy it. If no profit can be made, then</div>
  171. <div class="line">the answer should be 0.</div>
  172. </div>
  173. </td>
  174. </tr>
  175. <tr class="row-odd"><td>Minimum Path Sum in a Triangle</td>
  176. <td><div class="first last line-block">
  177. <div class="line">You are given a 2D array of numbers (array of array of numbers) that represents a</div>
  178. <div class="line">triangle (the first array has one element, and each array has one more element than</div>
  179. <div class="line">the one before it, forming a triangle). Find the minimum path sum from the top to the</div>
  180. <div class="line">bottom of the triangle. In each step of the path, you may only move to adjacent</div>
  181. <div class="line">numbers in the row below.</div>
  182. </div>
  183. </td>
  184. </tr>
  185. <tr class="row-even"><td>Unique Paths in a Grid I</td>
  186. <td><div class="first last line-block">
  187. <div class="line">You are given an array with two numbers: [m, n]. These numbers represent a</div>
  188. <div class="line">m x n grid. Assume you are initially positioned in the top-left corner of that</div>
  189. <div class="line">grid and that you are trying to reach the bottom-right corner. On each step,</div>
  190. <div class="line">you may only move down or to the right.</div>
  191. <div class="line"><br /></div>
  192. <div class="line"><br /></div>
  193. <div class="line">Determine how many unique paths there are from start to finish.</div>
  194. </div>
  195. </td>
  196. </tr>
  197. <tr class="row-odd"><td>Unique Paths in a Grid II</td>
  198. <td><div class="first last line-block">
  199. <div class="line">You are given a 2D array of numbers (array of array of numbers) representing</div>
  200. <div class="line">a grid. The 2D array contains 1’s and 0’s, where 1 represents an obstacle and</div>
  201. <div class="line"><br /></div>
  202. <div class="line">0 represents a free space.</div>
  203. <div class="line"><br /></div>
  204. <div class="line">Assume you are initially positioned in top-left corner of that grid and that you</div>
  205. <div class="line">are trying to reach the bottom-right corner. In each step, you may only move down</div>
  206. <div class="line">or to the right. Furthermore, you cannot move onto spaces which have obstacles.</div>
  207. <div class="line"><br /></div>
  208. <div class="line">Determine how many unique paths there are from start to finish.</div>
  209. </div>
  210. </td>
  211. </tr>
  212. <tr class="row-even"><td>Shortest Path in a Grid</td>
  213. <td><div class="first last line-block">
  214. <div class="line">You are given a 2D array of numbers (array of array of numbers) representing</div>
  215. <div class="line">a grid. The 2D array contains 1’s and 0’s, where 1 represents an obstacle and</div>
  216. <div class="line">0 represents a free space.</div>
  217. <div class="line"><br /></div>
  218. <div class="line">Assume you are initially positioned in top-left corner of that grid and that you</div>
  219. <div class="line">are trying to reach the bottom-right corner. In each step, you may move to the up,</div>
  220. <div class="line">down, left or right. Furthermore, you cannot move onto spaces which have obstacles.</div>
  221. <div class="line"><br /></div>
  222. <div class="line">Determine if paths exist from start to destination, and find the shortest one.</div>
  223. <div class="line"><br /></div>
  224. <div class="line">Examples:</div>
  225. <div class="line-block">
  226. <div class="line">[[0,1,0,0,0],</div>
  227. <div class="line-block">
  228. <div class="line">[0,0,0,1,0]] -&gt; “DRRURRD”</div>
  229. </div>
  230. <div class="line">[[0,1],</div>
  231. <div class="line-block">
  232. <div class="line">[1,0]]       -&gt; “”</div>
  233. <div class="line"><br /></div>
  234. </div>
  235. </div>
  236. </div>
  237. </td>
  238. </tr>
  239. <tr class="row-odd"><td>Sanitize Parentheses in Expression</td>
  240. <td><div class="first last line-block">
  241. <div class="line">Given a string with parentheses and letters, remove the minimum number of invalid</div>
  242. <div class="line">parentheses in order to validate the string. If there are multiple minimal ways</div>
  243. <div class="line">to validate the string, provide all of the possible results.</div>
  244. <div class="line"><br /></div>
  245. <div class="line">The answer should be provided as an array of strings. If it is impossible to validate</div>
  246. <div class="line">the string, the result should be an array with only an empty string.</div>
  247. <div class="line"><br /></div>
  248. <div class="line">Examples:</div>
  249. <div class="line-block">
  250. <div class="line">()())() -&gt; [()()(), (())()]</div>
  251. <div class="line">(a)())() -&gt; [(a)()(), (a())()]</div>
  252. <div class="line">)( -&gt; [“”]</div>
  253. </div>
  254. </div>
  255. </td>
  256. </tr>
  257. <tr class="row-even"><td>Find All Valid Math Expressions</td>
  258. <td><div class="first last line-block">
  259. <div class="line">You are given a string which contains only digits between 0 and 9 as well as a target</div>
  260. <div class="line">number. Return all possible ways you can add the +, -, and * operators to the string</div>
  261. <div class="line">of digits such that it evaluates to the target number.</div>
  262. <div class="line"><br /></div>
  263. <div class="line">The answer should be provided as an array of strings containing the valid expressions.</div>
  264. <div class="line"><br /></div>
  265. <div class="line">NOTE: Numbers in an expression cannot have leading 0’s</div>
  266. <div class="line">NOTE: The order of evaluation expects script operator precedence</div>
  267. <div class="line"><br /></div>
  268. <div class="line">Examples:</div>
  269. <div class="line-block">
  270. <div class="line">Input: digits = “123”, target = 6</div>
  271. <div class="line">Output: [1+2+3, 1*2*3]</div>
  272. <div class="line"><br /></div>
  273. <div class="line">Input: digits = “105”, target = 5</div>
  274. <div class="line">Output: [1*0+5, 10-5]</div>
  275. </div>
  276. </div>
  277. </td>
  278. </tr>
  279. <tr class="row-odd"><td>HammingCodes: Integer to Encoded Binary</td>
  280. <td><div class="first last line-block">
  281. <div class="line">You are given a decimal value.</div>
  282. <div class="line">Convert it into a binary string and encode it as a ‘Hamming-Code’. eg:</div>
  283. <div class="line">Value 8 will result into binary ‘1000’, which will be encoded</div>
  284. <div class="line">with the pattern ‘pppdpddd’, where p is a paritybit and d a databit,</div>
  285. <div class="line">or ‘10101’ (Value 21) will result into (pppdpdddpd) ‘1001101011’.</div>
  286. <div class="line">NOTE: You need an parity Bit on Index 0 as an ‘overall’-paritybit.</div>
  287. <div class="line">NOTE 2: You should watch the HammingCode-video from 3Blue1Brown, which</div>
  288. <div class="line">explains the ‘rule’ of encoding,</div>
  289. <div class="line">including the first Index parity-bit mentioned on the first note.</div>
  290. <div class="line">Now the only one rule for this encoding:</div>
  291. <div class="line-block">
  292. <div class="line">It’s not allowed to add additional leading ‘0’s to the binary value</div>
  293. </div>
  294. <div class="line">That means, the binary value has to be encoded as it is</div>
  295. </div>
  296. </td>
  297. </tr>
  298. <tr class="row-even"><td>HammingCodes: Encoded Binary to Integer</td>
  299. <td><div class="first last line-block">
  300. <div class="line">You are given an encoded binary string.</div>
  301. <div class="line">Treat it as a Hammingcode with 1 ‘possible’ error on an random Index.</div>
  302. <div class="line">Find the ‘possible’ wrong bit, fix it and extract the decimal value, which is</div>
  303. <div class="line">hidden inside the string.nn”,</div>
  304. <div class="line">Note: The length of the binary string is dynamic, but it’s encoding/decoding is</div>
  305. <div class="line">following Hammings ‘rule’n”,</div>
  306. <div class="line">Note 2: Index 0 is an ‘overall’ parity bit. Watch the Hammingcode-video from</div>
  307. <div class="line">3Blue1Brown for more informationn”,</div>
  308. <div class="line">Note 3: There’s a ~55% chance for an altered Bit. So… MAYBE</div>
  309. <div class="line">there is an altered Bit 😉n”,</div>
  310. <div class="line">Extranote for automation: return the decimal value as a string”,</div>
  311. </div>
  312. </td>
  313. </tr>
  314. <tr class="row-odd"><td>Proper 2-Coloring of a Graph</td>
  315. <td><div class="first last line-block">
  316. <div class="line">You are given data, representing a graph. Note that “graph”, as used here, refers to</div>
  317. <div class="line">the field of graph theory, and has no relation to statistics or plotting.</div>
  318. <div class="line"><br /></div>
  319. <div class="line">The first element of the data represents the number of vertices in the graph. Each</div>
  320. <div class="line">vertex is a unique number between 0 and ${data[0] - 1}. The next element of the data</div>
  321. <div class="line">represents the edges of the graph.</div>
  322. <div class="line"><br /></div>
  323. <div class="line">Two vertices u,v in a graph are said to be adjacent if there exists an edge [u,v].</div>
  324. <div class="line">Note that an edge [u,v] is the same as an edge [v,u], as order does not matter.</div>
  325. <div class="line"><br /></div>
  326. <div class="line">You must construct a 2-coloring of the graph, meaning that you have to assign each</div>
  327. <div class="line">vertex in the graph a “color”, either 0 or 1, such that no two adjacent vertices have</div>
  328. <div class="line">the same color. Submit your answer in the form of an array, where element i</div>
  329. <div class="line">represents the color of vertex i. If it is impossible to construct a 2-coloring of</div>
  330. <div class="line">the given graph, instead submit an empty array.</div>
  331. <div class="line"><br /></div>
  332. <div class="line">Examples:</div>
  333. <div class="line"><br /></div>
  334. <div class="line">Input: [4, [[0, 2], [0, 3], [1, 2], [1, 3]]]</div>
  335. <div class="line">Output: [0, 0, 1, 1]</div>
  336. <div class="line"><br /></div>
  337. <div class="line">Input: [3, [[0, 1], [0, 2], [1, 2]]]</div>
  338. <div class="line">Output: []</div>
  339. </div>
  340. </td>
  341. </tr>
  342. <tr class="row-even"><td>Compression I: RLE Compression</td>
  343. <td><div class="first last line-block">
  344. <div class="line">Run-length encoding (RLE) is a data compression technique which encodes data as a</div>
  345. <div class="line">series of runs of a repeated single character. Runs are encoded as a length, followed</div>
  346. <div class="line">by the character itself. Lengths are encoded as a single ASCII digit; runs of 10</div>
  347. <div class="line">characters or more are encoded by splitting them into multiple runs.</div>
  348. <div class="line"><br /></div>
  349. <div class="line">You are given a string as input. Encode it using run-length encoding with the minimum</div>
  350. <div class="line">possible output length.</div>
  351. <div class="line"><br /></div>
  352. <div class="line">Examples:</div>
  353. <div class="line-block">
  354. <div class="line">aaaaabccc            -&gt;  5a1b3c</div>
  355. <div class="line">aAaAaA               -&gt;  1a1A1a1A1a1A</div>
  356. <div class="line">111112333            -&gt;  511233</div>
  357. <div class="line">zzzzzzzzzzzzzzzzzzz  -&gt;  9z9z1z  (or 9z8z2z, etc.)</div>
  358. </div>
  359. </div>
  360. </td>
  361. </tr>
  362. <tr class="row-odd"><td>Compression II: LZ Decompression</td>
  363. <td><div class="first last line-block">
  364. <div class="line">Lempel-Ziv (LZ) compression is a data compression technique which encodes data using</div>
  365. <div class="line">references to earlier parts of the data. In this variant of LZ, data is encoded in two</div>
  366. <div class="line">types of chunk. Each chunk begins with a length L, encoded as a single ASCII digit</div>
  367. <div class="line">from 1 - 9, followed by the chunk data, which is either:</div>
  368. <div class="line"><br /></div>
  369. <div class="line-block">
  370. <div class="line">1. Exactly L characters, which are to be copied directly into the uncompressed data.</div>
  371. <div class="line">2. A reference to an earlier part of the uncompressed data. To do this, the length</div>
  372. <div class="line-block">
  373. <div class="line">is followed by a second ASCII digit X: each of the L output characters is a copy</div>
  374. <div class="line">of the character X places before it in the uncompressed data.</div>
  375. <div class="line"><br /></div>
  376. </div>
  377. </div>
  378. <div class="line">For both chunk types, a length of 0 instead means the chunk ends immediately, and the</div>
  379. <div class="line">next character is the start of a new chunk. The two chunk types alternate, starting</div>
  380. <div class="line">with type 1, and the final chunk may be of either type.</div>
  381. <div class="line"><br /></div>
  382. <div class="line">You are given an LZ-encoded string. Decode it and output the original string.</div>
  383. <div class="line"><br /></div>
  384. <div class="line">Example: decoding ‘5aaabb450723abb’ chunk-by-chunk</div>
  385. <div class="line-block">
  386. <div class="line">5aaabb           -&gt;  aaabb</div>
  387. <div class="line">5aaabb45         -&gt;  aaabbaaab</div>
  388. <div class="line">5aaabb450        -&gt;  aaabbaaab</div>
  389. <div class="line">5aaabb45072      -&gt;  aaabbaaababababa</div>
  390. <div class="line">5aaabb450723abb  -&gt;  aaabbaaababababaabb</div>
  391. </div>
  392. </div>
  393. </td>
  394. </tr>
  395. <tr class="row-even"><td>Compression III: LZ Compression</td>
  396. <td><div class="first last line-block">
  397. <div class="line">Lempel-Ziv (LZ) compression is a data compression technique which encodes data using</div>
  398. <div class="line">references to earlier parts of the data. In this variant of LZ, data is encoded in two</div>
  399. <div class="line">types of chunk. Each chunk begins with a length L, encoded as a single ASCII digit</div>
  400. <div class="line">from 1 - 9, followed by the chunk data, which is either:</div>
  401. <div class="line"><br /></div>
  402. <div class="line-block">
  403. <div class="line">1. Exactly L characters, which are to be copied directly into the uncompressed data.</div>
  404. <div class="line">2. A reference to an earlier part of the uncompressed data. To do this, the length</div>
  405. <div class="line-block">
  406. <div class="line">is followed by a second ASCII digit X: each of the L output characters is a copy</div>
  407. <div class="line">of the character X places before it in the uncompressed data.</div>
  408. <div class="line"><br /></div>
  409. </div>
  410. </div>
  411. <div class="line">For both chunk types, a length of 0 instead means the chunk ends immediately, and the</div>
  412. <div class="line">next character is the start of a new chunk. The two chunk types alternate, starting</div>
  413. <div class="line">with type 1, and the final chunk may be of either type.</div>
  414. <div class="line"><br /></div>
  415. <div class="line">You are given a string as input. Encode it using Lempel-Ziv encoding with the minimum</div>
  416. <div class="line">possible output length.</div>
  417. <div class="line"><br /></div>
  418. <div class="line">Examples (some have other possible encodings of minimal length):</div>
  419. <div class="line-block">
  420. <div class="line">abracadabra     -&gt;  7abracad47</div>
  421. <div class="line">mississippi     -&gt;  4miss433ppi</div>
  422. <div class="line">aAAaAAaAaAA     -&gt;  3aAA53035</div>
  423. <div class="line">2718281828      -&gt;  627182844</div>
  424. <div class="line">abcdefghijk     -&gt;  9abcdefghi02jk</div>
  425. <div class="line">aaaaaaaaaaaa    -&gt;  3aaa91</div>
  426. <div class="line">aaaaaaaaaaaaa   -&gt;  1a91031</div>
  427. <div class="line">aaaaaaaaaaaaaa  -&gt;  1a91041</div>
  428. </div>
  429. </div>
  430. </td>
  431. </tr>
  432. <tr class="row-odd"><td>Encryption I: Caesar Cipher</td>
  433. <td><div class="first last line-block">
  434. <div class="line">Caesar cipher is one of the simplest encryption technique.  It is a type of</div>
  435. <div class="line">substitution cipher in which each letter in the plaintext is replaced by a letter some</div>
  436. <div class="line">fixed number of positions down the alphabet. For example, with a left shift of 3, D</div>
  437. <div class="line">would be replaced by A, E would become B, and A would become X (because of rotation).</div>
  438. <div class="line">You are given an array with two elements. The first element is the plaintext, the</div>
  439. <div class="line">second element is the left shift value. Return the ciphertext as uppercase string.</div>
  440. <div class="line">Spaces remains the same.</div>
  441. </div>
  442. </td>
  443. </tr>
  444. <tr class="row-even"><td>Encryption II: Vigenère Cipher</td>
  445. <td><div class="first last line-block">
  446. <div class="line">Vigenère cipher is a type of polyalphabetic substitution. It uses the Vigenère square</div>
  447. <div class="line">to encrypt and decrypt plaintext with a keyword.</div>
  448. <div class="line-block">
  449. <div class="line">Vignenère square:</div>
  450. <div class="line-block">
  451. <div class="line-block">
  452. <div class="line-block">
  453. <div class="line">A B C D E F G H I J K L M N O P Q R S T U V W X Y Z</div>
  454. </div>
  455. <div class="line">+—————————————————-</div>
  456. </div>
  457. <div class="line">A | A B C D E F G H I J K L M N O P Q R S T U V W X Y Z</div>
  458. <div class="line">B | B C D E F G H I J K L M N O P Q R S T U V W X Y Z A</div>
  459. <div class="line">C | C D E F G H I J K L M N O P Q R S T U V W X Y Z A B</div>
  460. <div class="line">D | D E F G H I J K L M N O P Q R S T U V W X Y Z A B C</div>
  461. <div class="line">E | E F G H I J K L M N O P Q R S T U V W X Y Z A B C D</div>
  462. <div class="line-block">
  463. <div class="line"></div>
  464. </div>
  465. <div class="line">Y | Y Z A B C D E F G H I J K L M N O P Q R S T U V W X</div>
  466. <div class="line">Z | Z A B C D E F G H I J K L M N O P Q R S T U V W X Y</div>
  467. </div>
  468. </div>
  469. <div class="line">For encryption each letter of the plaintext is paired with the corresponding letter of</div>
  470. <div class="line">a repeating keyword. For example, the plaintext DASHBOARD is encrypted with the</div>
  471. <div class="line">keyword LINUX:</div>
  472. <div class="line-block">
  473. <div class="line">Plaintext: DASHBOARD</div>
  474. <div class="line">Keyword:   LINUXLINU</div>
  475. </div>
  476. <div class="line">So, the first letter D is paired with the first letter of the key L. Therefore, row D</div>
  477. <div class="line">and column L of the Vigenère square are used to get the first cipher letter O. This</div>
  478. <div class="line">must be repeated for the whole ciphertext.</div>
  479. <div class="line">You are given an array with two elements. The first element is the plaintext, the</div>
  480. <div class="line">second element is the keyword. Return the ciphertext as uppercase string.</div>
  481. </div>
Tags: Bitburner
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement