public int question1(int n){ return helper(0, n); } private int helper(int position, int remain){ if (position == 0){ return 1; } if (remain == 0){ return 0; } int nextRight = (position + 1) >= 12 ? (position + 1) % 12 : (position + 1); int nextLeft = (position - 1) < 0 ? (position - 1) +12 : (position - 1); return helper(nextRight, remain - 1) + helper(nextLeft, remain - 1); }
点赞 8

相关推荐

2024-12-26 13:00
太原理工大学 Java
会飞的猿:简历没啥大问题啊,感觉是缺少了实习经历。多投投先找个中小厂过渡一下吧
点赞 评论 收藏
分享
牛客网
牛客企业服务