Skip to main content

AustinLeath

User since Nov 17, 2022
100 Posts
Python
C++
JavaScript
PHP
Plaintext
Java
C#
JSON
Shell
TypeScript
C
PowerShell
Go
Perl
PostgreSQL
Ruby
Swift
YAML

Recent Posts

dsafgsdfgsdfgh

0 likes • Feb 6, 2024 • 1 view
Go
szdfghsdfg

typescript hello

0 likes • Nov 21, 2023 • 19 views
TypeScript
// Print Hello, World!
console.log("Hello, World!");

ruby hello

0 likes • Nov 21, 2023 • 10 views
Ruby
# Print Hello, World!
puts "Hello, World!"

perl hello world

0 likes • Nov 21, 2023 • 7 views
Perl
#!/usr/bin/perl
use strict;
use warnings;
print "Hello, World!\n";

longest sequence

0 likes • Oct 7, 2023 • 5 views
Java
import java.util.Arrays;
public class LongestIncreasingSubsequence {
public int lengthOfLIS(int[] nums) {
if (nums.length == 0) {
return 0;
}
int[] dp = new int[nums.length];
Arrays.fill(dp, 1); // Initialize all elements in dp array to 1, as each element itself is a valid subsequence of length 1.
int maxLength = 1; // Initialize the maximum length to 1, considering a single element as the sequence.
for (int i = 1; i < nums.length; i++) {
for (int j = 0; j < i; j++) {
if (nums[i] > nums[j]) {
dp[i] = Math.max(dp[i], dp[j] + 1); // If nums[i] is greater than nums[j], update the longest subsequence length ending at i.
}
}
maxLength = Math.max(maxLength, dp[i]); // Update the maximum length if needed.
}
return maxLength;
}
public static void main(String[] args) {
LongestIncreasingSubsequence lis = new LongestIncreasingSubsequence();
int[] nums = {10, 9, 2, 5, 3, 7, 101, 18};
int result = lis.lengthOfLIS(nums);
System.out.println("Length of the Longest Increasing Subsequence: " + result); // Output: 4
}
}

set hostname syscall

0 likes • Oct 7, 2023 • 10 views
C++
#include <iostream>
#include <cstring>
#include <unistd.h>
#include <sys/utsname.h>
int main() {
char newHostname[] = "newhostname"; // Replace with the desired hostname
if (sethostname(newHostname, strlen(newHostname)) == 0) {
std::cout << "Hostname set to: " << newHostname << std::endl;
// Optionally, update the /etc/hostname file to make the change permanent
FILE *hostnameFile = fopen("/etc/hostname", "w");
if (hostnameFile != NULL) {
fprintf(hostnameFile, "%s\n", newHostname);
fclose(hostnameFile);
} else {
perror("Failed to update /etc/hostname");
}
} else {
perror("Failed to set hostname");
}
return 0;
}

Post Statistics

Posts

No Posts Found

It looks like AustinLeath hasn't uploaded a post yet

Likes

Please Log In

You must be authenticated to view a user's likes

Shared

Please Log In

You must be authenticated to view a user's shared posts

Profile Privacy

Multi-Factor Authentication

Multi-Factor Authentication (MFA) is an authentication method that requires you to provide two or more verification factors to gain access to your account. In addition to username and password, MFA requires you to verify your email on every login, which decreases the likelihood of someone stealing your account.

Change Password

Forgot Password?

Identity Color

Changes the color of your profile icon and cursor highlight in the live code editor. You and other users will be able to view this change.

Delete Account

Deleting your account is permanent. All data associated with your account will be lost.