Skip to content

added 2d array article #236

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 14, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix links to sols
  • Loading branch information
Allynixtor committed Apr 14, 2023
commit 06e850bce30095683c43244238ad4019a997f157
7 changes: 3 additions & 4 deletions data/course-revision/1511-23T1/anagram.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ difficulty: 2

# Anagram?


An anagram is a word formed by rearranging the letters of a different word.

Write a program `anagram.c` which scans two lines of input, where each line contains a single word which is a string.
Expand All @@ -21,14 +20,14 @@ $ dcc anagram.c -o anagram
$ ./anagram
angel
glean
Your two words are an anagram!
Your two words are an anagram!
```

```bash:~/1511-revision/anagram
$ ./anagram
yummy
mummy
Your two words are not an anagram!
Your two words are not an anagram!
```

## Assumptions/Restrictions/Clarifications
Expand All @@ -47,4 +46,4 @@ $ 1511 csesoc-autotest anagram

## Solution

You can view the solution code to this problem [here](https://github.com/csesoc/comp1511-revision-t1-2022/blob/master/solutions/anagram/solution.c).
You can view the solution code to this problem [here](https://github.com/Allynixtor/comp1511-23T1-problems/tree/main/solutions/anagram).
2 changes: 1 addition & 1 deletion data/course-revision/1511-23T1/best_youtuber.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@ $ 1511 csesoc-autotest best_youtuber

## Solution

You can view the solution code to this problem [here](https://github.com/csesoc/comp1511-revision-t1-2022/blob/master/solutions/best-youtuber/solution.c).
You can view the solution code to this problem [here](https://github.com/Allynixtor/comp1511-23T1-problems/tree/main/solutions/best-youtuber).
3 changes: 1 addition & 2 deletions data/course-revision/1511-23T1/billys_books.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,10 @@ ABCDEFGHIJK

When you think your program is working, you can use CSE autotest to test your solution.


```bash:~/1511-revision/billys_books
$ 1511 csesoc-autotest billys_books
```

## Solution

You can view the solution code to this problem [here](https://github.com/csesoc/comp1511-revision-t1-2022/blob/master/solutions/billys-books/solution.c).
You can view the solution code to this problem [here](https://github.com/Allynixtor/comp1511-23T1-problems/tree/main/solutions/billys-books).
2 changes: 1 addition & 1 deletion data/course-revision/1511-23T1/charming_three.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ $ 1511 csesoc-autotest charming_three

## Solution

You can view the solution code to this problem [here](https://github.com/csesoc/comp1511-revision-t1-2022/blob/master/solutions/charming_three/solution.c).
You can view the solution code to this problem [here](https://github.com/Allynixtor/comp1511-23T1-problems/tree/main/solutions/charming_three).
9 changes: 4 additions & 5 deletions data/course-revision/1511-23T1/letter_pairs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,11 @@ Write a program that reads a lowercase string as input, counts and prints out th

- No letters will appear consecutively more than twice (e.g. "aaa" will not be an input).


## Examples

### Example 1

Input:
Input:

```bash:~/1511-revision/letter_pairs
$ dcc letter_pairs.c -o letter_pairs
Expand All @@ -42,7 +41,7 @@ Explanation: The double letter pair “ee” occurs twice in this word.

### Example 2

Input:
Input:

```bash:~/1511-revision/letter_pairs
$ dcc letter_pairs.c -o letter_pairs
Expand All @@ -60,7 +59,7 @@ Explanation: The double letter pairs “ll” and “oo” each appear once in t

### Example 3

Input:
Input:

```bash:~/1511-revision/letter_pairs
$ dcc letter_pairs.c -o letter_pairs
Expand All @@ -86,4 +85,4 @@ $ 1511 csesoc-autotest letter_pairs

## Solution

You can view the solution code to this problem [here](https://github.com/csesoc/comp1511-revision-t1-2022/blob/master/solutions/double-letters/solution.c).
You can view the solution code to this problem [here](https://github.com/Allynixtor/comp1511-23T1-problems/tree/main/solutions/double-letters).
14 changes: 6 additions & 8 deletions data/course-revision/1511-23T1/marc_coin.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ After all transactions have been made, Bill and Ethan may decide to 'reverse' `R
Write a program `marc_coin.c` takes in the following input:

1. A line containing non-negative integers `T` and `R` which are the number of transactions and reversals, respectively.
2. `T` lines each describe a transaction, including:
- a unique and random 3-digit integer transaction ID such as `845`,
- a non-negative integer Marc Coin value such as `23`, and
- a single character denoting the sender, either `B` for Bill or `E` for Ethan.
2. `T` lines each describe a transaction, including:
- a unique and random 3-digit integer transaction ID such as `845`,
- a non-negative integer Marc Coin value such as `23`, and
- a single character denoting the sender, either `B` for Bill or `E` for Ethan.
3. `R` lines each describe a reversal using a transaction ID.

Then output a single line with two integers separated by a space: Bill and Ethan's final balances, respectively.
Expand All @@ -32,8 +32,6 @@ For example, if there were 2 transactions, one where Billy sent Ethan 15 Marc Co

The output for your program should look **exactly** like this:



```bash:~/1511-revision/marc_coin
$ dcc marc_coin.c -o marc_coin
$ ./marc_coin
Expand All @@ -45,6 +43,7 @@ $ ./marc_coin
```

## Assumptions/Restrictions/Clarifications

- `0 < R <= T < 1000`
- All given transaction IDs will be unique.
- All given reversals will only be made on existing transactions and no more than once.
Expand All @@ -54,11 +53,10 @@ $ ./marc_coin

When you think your program is working, you can use CSE autotest to test your solution.


```bash:~/1511-revision/marc_coin
$ 1511 csesoc-autotest marc_coin
```

## Solution

You can view the solution code to this problem [here](https://github.com/csesoc/comp1511-revision-t1-2022/blob/master/solutions/marc-coin/solution.c).
You can view the solution code to this problem [here](https://github.com/Allynixtor/comp1511-23T1-problems/blob/main/solutions/marc-coin/solution.c).
7 changes: 4 additions & 3 deletions data/course-revision/1511-23T1/oldest_group.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Write a program `oldest_group.c` which scans the following input:
1. The first line of input contains the integer N, the number of groups.
2. The following N pairs of lines describe a group each. The first line in each pair holds the value K_i, which is the number of people in the group. The second line is K_i elements long and describes the ages of the people in that group.

Your program should then output the group with the largest sum of their ages.
Your program should then output the group with the largest sum of their ages.

If two groups have the same sum of ages, print the group with the lower group number.

Expand All @@ -38,7 +38,7 @@ $ ./oldest_group
3
2
35 27
2
2
48 23
1
98
Expand All @@ -48,6 +48,7 @@ $ ./oldest_group
## Assumptions/Restrictions/Clarifications

For all test cases:

- 1 ≤ N ≤ 1000
- 1 ≤ K_i ≤ 1000
- The age of any person A is an integer 1 ≤ A ≤ 100
Expand All @@ -62,4 +63,4 @@ $ 1511 csesoc-autotest oldest_group

## Solution

You can view the solution code to this problem [here](https://github.com/csesoc/comp1511-revision-t1-2022/blob/master/solutions/oldest-group/solution.c).
You can view the solution code to this problem [here](https://github.com/Allynixtor/comp1511-23T1-problems/blob/main/solutions/oldest-group/solution.c).
2 changes: 1 addition & 1 deletion data/course-revision/1511-23T1/pallys-palindrome.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ $ 1511 csesoc-autotest pallys_palindromes

## Solution

You can view the solution code to this problem [here](https://github.com/csesoc/comp1511-revision-t1-2022/blob/master/solutions/pallys-palindromes/solution.c).
You can view the solution code to this problem [here](https://github.com/Allynixtor/comp1511-23T1-problems/tree/main/solutions/pallys-palindromes).
6 changes: 1 addition & 5 deletions data/course-revision/1511-23T1/scissors_paper_rock.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,4 @@ $ 1511 csesoc-autotest scissors_paper_rock

## Solution

You can view the solution code to this problem [here](https://github.com/csesoc/comp1511-revision-t1-2022/blob/master/solutions/scissors-paper-rock/solution.c).




You can view the solution code to this problem [here](https://github.com/Allynixtor/comp1511-23T1-problems/blob/main/solutions/scissors-paper-rock/solution.c).
2 changes: 1 addition & 1 deletion data/course-revision/1511-23T1/scrambled_scrabble.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,4 @@ $ 1511 csesoc-autotest scrambled_scrabble

## Solution

You can view the solution code to this problem [here](https://github.com/csesoc/comp1511-revision-t1-2022/blob/master/solutions/scrambled-scrabble/solution.c).
You can view the solution code to this problem [here](https://github.com/Allynixtor/comp1511-23T1-problems/blob/main/solutions/scrambled-scrabble/solution.c).
2 changes: 1 addition & 1 deletion data/course-revision/1511-23T1/shauns_sheep.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@ $ 1511 csesoc-autotest shauns_sheep

## Solution

You can view the solution code to this problem [here](https://github.com/csesoc/comp1511-revision-t1-2022/blob/master/solutions/shauns_sheep).
You can view the solution code to this problem [here](https://github.com/Allynixtor/comp1511-23T1-problems/tree/main/solutions/shauns_sheep).
2 changes: 1 addition & 1 deletion data/course-revision/1511-23T1/sweet_potatoes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,4 @@ $ 1511 csesoc-autotest sweet_potatoes

## Solution

You can view the solution code to this problem [here](https://github.com/csesoc/comp1511-revision-t1-2022/blob/master/solutions/sweet_potatoes).
You can view the solution code to this problem [here](https://github.com/Allynixtor/comp1511-23T1-problems/tree/main/solutions/sweet_potatoes).
10 changes: 5 additions & 5 deletions data/course-revision/1511-23T1/train_trauma.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ difficulty: 3

The train network in Sydney has been problematic for some time now, so the government is trying a new 'rapid prototyping approach'. Every day, one of the following will happen:

1) A new station will be added. This station will initially be unconnected to the rest of the network.
2) A new track will be added between two existing stations, replacing the previous track coming out from the start station if one existed.
1. A new station will be added. This station will initially be unconnected to the rest of the network.
2. A new track will be added between two existing stations, replacing the previous track coming out from the start station if one existed.

Before the start of day 1, there are two stations: one near your house (initially named "home"), and one at UNSW (initially named "unsw"), which are initially connected by a track. At the start of each day, one of the above operations will occur.
Before the start of day 1, there are two stations: one near your house (initially named "home"), and one at UNSW (initially named "unsw"), which are initially connected by a track. At the start of each day, one of the above operations will occur.

Every day, your task is to determine whether it is possible to make it to UNSW by train.

Expand All @@ -25,7 +25,7 @@ Following this will be the same number of lines, which may be any of the followi

Your output should contain a number of lines equal to the integer.

On each line of output, you should output "YES" if it is possible to travel from the stop at your house to the stop at UNSW after the change on the that day, and "NO" otherwise.
On each line of output, you should output "YES" if it is possible to travel from the stop at your house to the stop at UNSW after the change on the that day, and "NO" otherwise.

The output from your program should look **exactly** like this:

Expand Down Expand Up @@ -109,4 +109,4 @@ $ 1511 csesoc-autotest train_trauma

## Solution

You can view the solution code to this problem [here](https://github.com/csesoc/comp1511-revision-t1-2022/blob/master/solutions/train-trauma/solution.c).
You can view the solution code to this problem [here](https://github.com/Allynixtor/comp1511-23T1-problems/blob/main/solutions/train-trauma/solution.c).