Welcome to fdisk (util-linux 2.39.3). Changes will remain in memory only, until you decide to write them. Be careful before using the write command.
Device does not contain a recognized partition table. Created a new DOS (MBR) disklabel with disk identifier 0x7fdee095.
Command (m for help): g Created a new GPT disklabel (GUID: 44B24C46-37DF-4C7C-9C00-ACD7C1FED25F).
Command (m for help): n Partition number (1-128, default 1): First sector (2048-62914526, default 2048): Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-62914526, default 62912511):
Created a new partition 1 of type 'Linux filesystem' and of size 30 GiB.
Command (m for help): p Disk /dev/sdb: 30 GiB, 32212254720 bytes, 62914560 sectors Disk model: VBOX HARDDISK Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: gpt Disk identifier: 44B24C46-37DF-4C7C-9C00-ACD7C1FED25F
Device Start End Sectors Size Type /dev/sdb1 2048 62912511 62910464 30G Linux filesystem
Command (m for help): w The partition table has been altered. Calling ioctl() to re-read partition table. Syncing disks.
luowanqian@LFS:~/Documents/Code/LFS$ sudo mkfs -v -t ext4 /dev/sdb1 mke2fs 1.47.0 (5-Feb-2023) fs_types for mke2fs.conf resolution: 'ext4' Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) Stride=0 blocks, Stripe width=0 blocks 1966080 inodes, 7863808 blocks 393190 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=2155872256 240 block groups 32768 blocks per group, 32768 fragments per group 8192 inodes per group Filesystem UUID: e24fc955-4016-4b3c-9ef3-712469fb2434 Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000
Allocating group tables: done Writing inode tables: done Creating journal (32768 blocks): done Writing superblocks and filesystem accounting information: done
luowanqian@LFS:~/Documents/Code/LFS$ cat /etc/fstab # /etc/fstab: static file system information. # # Use 'blkid' to print the universally unique identifier for a # device; this may be used with UUID= as a more robust way to name devices # that works even if disks are added and removed. See fstab(5). # # <file system> <mount point> <type> <options> <dump> <pass> # / was on /dev/sda2 during curtin installation /dev/sdb1 /mnt/lfs ext4 defaults 1 1
Given a linked list, return the node where the cycle begins. If there is no cycle, return null.
To represent a cycle in the given linked list, we use an integer pos which represents the position (0-indexed) in the linked list where tail connects to. If pos is -1, then there is no cycle in the linked list.
Note: Do not modify the linked list.
Example 1:
1 2 3
Input: head = [3,2,0,-4], pos = 1 Output: tail connects to node index 1 Explanation: There is a cycle in the linked list, where tail connects to the second node.
Example 2:
1 2 3
Input: head = [1,2], pos = 0 Output: tail connects to node index 0 Explanation: There is a cycle in the linked list, where tail connects to the first node.
Example 3:
1 2 3
Input: head = [1], pos = -1 Output: no cycle Explanation: There is no cycle in the linked list.
Given a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not the value in the nodes.
You should try to do it in place. The program should run in O(1) space complexity and O(nodes) time complexity.