## Walking the Approximate Longest Path

Jenna is playing a computer game involving a large map with n cities numbered sequentially from 1 to n that are connected by m bidirectional roads. The game's objective is to travel to as many cities as possible without visiting any city more than once. The more cities the player visits, the more points they earn. As Jenna's fellow student at Hackerland University, she asks you for help choosing an optimal path. Given the map, can you help her find a path that maximizes her score? Note: S

## Sam's Puzzle (Approximate)

Sam invented a new puzzle game played on an n x n matrix named puzzle, where each cell contains a unique integer in the inclusive range between 1 and n^2. The coordinate of the top-left cell is (1, 1). The Moves A move consists of two steps: Choose a sub-square of puzzle. Rotate the sub-square in the clockwise direction. Good Pairs of Cells A pair of cell is good if one of the following is true: They're located in the same row and the number in the left cell is less than the

## Spies, Revised

Two spies in a grid will have their covers blown if: 1 . They are both in the same row. 2. They are both in the same column. 3. They can see each other diagonally (i.e., lie in a line inclined 45° or 135° to the base of the grid). The level of danger is now increased! In addition to the conditions above, no 3 spies may lie in any straight line. This line need not be aligned 45° or 135° to the base of grid. Write a program in the language of your choice to place N spies (one spy per ro

## Alternating Characters

You are given a string containing characters A and B only. Your task is to change it into a string such that there are no matching adjacent characters. To do this, you are allowed to delete zero or more characters in the string. Your task is to find the minimum number of required deletions. Function Description Complete the alternatingCharacters function in the editor below. alternatingCharacters has the following parameter(s): string s: a string Returns int: the minimum n

## Beautiful Binary String

Alice has a binary string. She thinks a binary string is beautiful if and only if it doesn't contain the substring "010". In one step, Alice can change a 0 to a 1 or vice versa. Count and print the minimum number of steps needed to make Alice see the string as beautiful. Example b = 010 She can change any one element and have a beautiful string. Function Description Complete the beautifulBinaryString function in the editor below. beautifulBinaryString has the following par