Solution of tricky algorithms problems