solve practice B problem