This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:flutter/material.dart'; | |
| void main() => runApp(MyApp()); | |
| class MyApp extends StatelessWidget { | |
| @override | |
| Widget build(BuildContext context) { | |
| return MaterialApp( | |
| home: Scaffold( | |
| body: Center( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class Question1 { | |
| public static void main(String[] args) { | |
| //Outputs for BunnyEar Functions | |
| System.out.println(bunnyEars(0)); | |
| System.out.println(bunnyEars(1)); | |
| System.out.println(bunnyEars(2)); | |
| System.out.println(bunnyEars(234)); | |
| //Output for Equals Not Function |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Q1. We have a number of bunnies and each bunny has two big floppy ears. We want to compute the total number of ears across all the bunnies recursively (without loops or multiplication). | |
| bunnyEars(0) β 0 | |
| bunnyEars(1) β 2 | |
| bunnyEars(2) β 4 | |
| bunnyEars(234) β 468 | |
| ________________________________________________________________________________________________________________________________________ | |
| package projects; | |
| import java.util.*; | |
| public class FloppyEars { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class Weak2 { | |
| /* | |
| Q1. We have a number of bunnies and each bunny has two big floppy ears. | |
| We want to compute the total number of ears across all the bunnies | |
| recursively (without loops or multiplication). | |
| bunnyEars(0) β 0 | |
| bunnyEars(1) β 2 | |
| bunnyEars(2) β 4 |