Left-hand picture -- it may seem that you haven't been given enough information, but you don't need the other dimensions.
Going from the top-left-hand corner to the bottom-right-hand corner, you will go a distance of 12 + 10 = 22.
And, it will be 22 no matter which way you go. The entire trip will be 22 + 22 = 44.
For the right-hand picture -- if there were no indentation of 2 in the middle, you would go (9 + 11) x 2 = 40.
But you will be going an extra 2 up and 2 down, for a total of 44.
I tink that a good way of looking at this would be to pretend that you are walking city blocks.