Peak-to-Average Power Ratio in OFDMA Communication
In both cases peak is just the square of the largest amplitude, so that is easy. 

The pulses are square so there is no need for integration as such, just multiplying the peak power by the duty cycle gets you there. 

In the top case, pulse with is 2, period is 4, amplitude is 3, so \$3^2 \times 2/4 = 4.5\$. In the lower one, pulse width is 0.5, period is 4, amplitude is 6, so \$6^2 \times 0.5/4 = 4.5\$

In a more general case you integrate \$x^2(t)\$ dt over the period of a cycle and get in this case exactly the same result.